[SOLVED] python 2019/12/7 CSE 216 Object-oriented programming and unit testing in Python

$25

File Name: python_2019/12/7_CSE_216__Object-oriented_programming_and_unit_testing_in_Python.zip
File Size: 753.6 KB

5/5 - (1 vote)

2019/12/7 CSE 216 Object-oriented programming and unit testing in Python
CSE 216
Syllabus Lectures Recitations Assignment
Assignment 5: Object-oriented programming and unit testing in Python
This is the last assignment of the semester, and it is significantly shorter than the earlier ones. In this assignment, you are being asked to do a few things very similar to the second assignment. Specifically, there is some code being given to you for the classes being used. These are:
1. two_d_point.py 2. quadrilateral.py 3. rectangle.py
4. square.py
Additionally, there are also some test class skeletons also provided (test_two_d_point.py and test_quadrilateral.py).
Your tasks are as follows:
1. Complete the codebase for TwoDPoint, Quarilateral, Rectangle, and Square. The incomplete portions of the code are marked with TODO and the methods are provided with documentation explaining what each incomplete method should do. There may also be a few minor bugs in the provided code. It is a part of this assignment to fix these (you are encouraged to use the debugger and discover these bugs by use of unit tests, if necessary).
TwoDPoint (8 points) Quadrilateral (10 points) Rectangle (10 points) Square (8 points)
2. Write a class called ShapeSorter (the file name must be sorter.py) with a method called sort. This method should take as its argument a variable number of quadrilaterals (i.e., *args) and return a list of these shapes sorted in increasing order of their smallest x-coordinate. You must also decide if this method should be an instance, static, or class method. (14 points)
3. Every shape (i.e., quadrilateral, rectangle, and square) must also use the appropriate magic methods to check for equality and to have a human-readable string representation of an instance of the class. (10 points)
4 Any method you write in the above tasks must also have corresponding unit tests in the properly named
https://sites.google.com/cs.stonybrook.edu/cse-216/assignments/object-oriented-programming-and-unit-testing-in-python?authuser=0 1/2

2019/12/7 CSE 216 Object-oriented programming and unit testing in Python
4. Any method you write in the above tasks must also have corresponding unit tests in the properly named
test classes. You are required to follow the naming conventions of the unit test classes and methods as
CSE 216
Syllabus Lectures Recitations Assignmen
shown by the two test class skeletons provided. (30 points)
The sorting method must have at least 4 unique test cases, one of which must be a boundary value.
The snap and membership checking methods must have at least 2 unique test cases (each).
5. Any method you write (except for the unit tests) must also have complete type hints for the methods arguments and return type. For this, do not use any imports from the __future__ module. The given codebase already shows you how to do this. (10 points)
Unimplemented (or mostly unimplemented) methods with just the type hints added to the signature will not be given points for this task.
The codebase is available here.
A note on Python syntax of importing modules
Import statements in Python can be absolute or relative (recall that the dot-based syntax in import statements are translated to paths. So, for two files in the same package or folder, you may use either option. For example, the import statement in quadrilateral.py is
from .two_d_point import TwoDPoint but it could have also been written explicitly as
from just_a_folder.two_d_point import TwoDPoint
Both are semantically equivalent.
NOTES
Python version: 3.x (x >= 6).
What to submit? A single .zip file comprising (i) the completed codebase of the classes provided, (ii) sorter.py, and (iii) the various test classes. Your submission should not contain any additional files.
As always, make sure your code compiles and runs. Uncompilable code will not be graded.
2019 Ritwik Banerjee
t
https://sites.google.com/cs.stonybrook.edu/cse-216/assignments/object-oriented-programming-and-unit-testing-in-python?authuser=0 2/2

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] python 2019/12/7 CSE 216 Object-oriented programming and unit testing in Python
$25