tests/- Main functions provided by Holberton School to test the files and.txtfiles for testing usingDoctest.
- 0. Lookup
0-lookup.py- Function that returns the list of available attributes and methods of an object.
- 1. My list
1-my_list.py- ClassMyListthat inherits fromlistwith:- Public instance method
def print_sorted(self)that prints the list in ascending sorted order.
- Public instance method
tests/1-my_list.txt- Test file withDoctest.
- 2. Exact same object
2-is_same_class.py- Function that returnsTrueif the object is exactly an instance of the specified class ; otherwiseFalse.
- 3. Same class or inherit from
3-is_kind_of_class.py- Function that returnsTrueif the object is an instance of, or if the object is an instance of a class that inherited from, the specified class ; otherwiseFalse.
- 4. Only sub class of
4-inherits_from.py- Function that returnsTrueif the object is an instance of a class that inherited (directly or indirectly) from the specified class ; otherwiseFalse.
- 5. Geometry module
5-base_geometry.py- Empty classBaseGeometry.
- 6. Improve Geometry
6-base_geometry.py- ClassBaseGeometry. Based on5-base_geometry.pywith:- Public instance method
def area(self)that raises anExceptionwith the messagearea() is not implemented.
- Public instance method
- 7. Integer validator
7-base_geometry.py- ClassBaseGeometry. Based on6-base_geometry.pywith:- Public instance method
def integer_validator(self, name, value)that validates the parametervalue. - The parameter
valuemust be anint, otherwise, aTypeErrorexception is raised with the message<name> must be an integer. - The parameter
valuemust be greater than0, otherwise, aValueErrorexception is raised with the message<value> must be greater than 0.
- Public instance method
tests/7-base_geometry.txt- Test file withDoctest.
- 8. Rectangle
8-rectangle.py- ClassRectanglethat inherits fromBaseGeometry(7-base_geometry.py) with:- Instantiation with
widthandheight:def __init__(self, width, height). - Private attributes
widthandheight- validated withinteger_validator.
- Instantiation with
- 9. Full rectangle
9-rectangle.py- ClassRectanglethat inherits fromBaseGeometry(7-base_geometry.py). Based on8-rectangle.pywith:- Implementation of the method
area(). - Special method
__str__to print the following rectangle description:[Rectangle] <width>/<height>.
- Implementation of the method
- 10. Square #1
10-square.py- ClassSquarethat inherits fromRectangle(9-rectangle.py) with:- Instantiation with
size:def __init__(self, size). - Private attribute
size- validated withinteger_validator. - Implementation of the
area()method.
- Instantiation with
- 11. Square #2
11-square.py- ClassSquarethat inherits fromRectangle(9-rectangle.py). Based on10-square.pywith:- Special method
__str__to print the square description:[Square] <width>/<height>.
- Special method
- Felipe Villamizar - GitHub