Add docstrings for constraints.py and implement unit test framework for Constraints class #23
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.
Add Docstrings for
constraints.py
and Implement Unit Test Framework forConstraints
ClassDescription
This pull request introduces the following changes to the
src/constraint.py
file andtest/test_quadratic_program.py
:Constraints
class and its methods to improve code readability and make it easier to use.TestConstraintsMethods()
for unit tests for theConstraints
class.test_add_constaints_init()
andtest_add_constraints_init_error()
: This method validates the correct initialization of theConstraints
class.These improvements aim to help developers better understand the functionality and usage of the
Constraints
class, and the unit test framework will ensure to reach 100% coverage in the Constraint class insrc/constraint.py
.Changes:
1. Added Docstrings
Constraints
class to describe their functionality, parameters, return values, and potential exceptions.2. Unit Test Framework
Created a basic unit test structure using the
unittest
framework.Implemented the
test_init()
method to test the initialization logic of theConstraints
class, verifying that theselection
argument is processed correctly and that the class attributes are initialized properly.Example of
test_add_constaints_init(self)
method:3. Updated Import Paths:
I changed the import statements in the code to reflect the updated folder structure. Specifically:
This change was necessary because the test file is not directly under the root folder. With the modified folder structure, imports need to be adjusted to access the correct modules from the
src/
directory.Next Steps:
TestConstraintsMethods Class
in the next few commits.Thanks!