Enhanced, Updated code snippets & test cases for the Dynamic classes #463
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✅ Closes: #462
This pull request introduces several dynamic programming techniques in Python, including dynamic class creation, dynamic method and attribute assignment, and dynamic property creation. Additionally, it includes test cases for each of these techniques to ensure their correct implementation.
Dynamic programming techniques:
pysnippets/DYnamic_classes/Dynamic_class.py
: Added functions to dynamically create and assign functions to a class. Implemented aMathOperations
class with dynamically createdadd
andmultiply
methods.pysnippets/DYnamic_classes/Property.py
: Added a function to create dynamic properties in a class. Implemented aUserProfile
class with dynamicname
andage
properties.pysnippets/DYnamic_classes/attribute.py
: Added dynamic attribute assignment to a class instance through theConfig
class.pysnippets/DYnamic_classes/method.py
: Added dynamic method creation and assignment to theCalculator
class.pysnippets/DYnamic_classes/type.py
: Added dynamic class creation usingtype
, and defined aDynamicPerson
class with dynamic attributes and methods.Testing:
pysnippets/DYnamic_classes/test_Dynamic_class.py
: Added test cases for theMathOperations
class to verify the dynamically createdadd
andmultiply
methods.pysnippets/DYnamic_classes/test_property.py
: Added test cases for theUserProfile
class to verify the dynamic propertiesname
andage
.pysnippets/DYnamic_classes/test_attribute.py
: Added test cases for theConfig
class to verify dynamic attribute assignment.pysnippets/DYnamic_classes/test_method.py
: Added test cases for theCalculator
class to verify the dynamically createdadd
andsubtract
methods.pysnippets/DYnamic_classes/test_type.py
: Added test cases for theDynamicPerson
class to verify dynamic class creation and its attributes and methods.pysnippets/DYnamic_classes/test_all.py
: Created a test suite to run all the test cases together usingunittest
.TESTING
@UTSAVS26 Kindly review this PR, I request you to assign
lvl 3