-
Notifications
You must be signed in to change notification settings - Fork 10
Polygon as_segments()
#168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Polygon as_segments()
#168
Conversation
| def test_as_segments(self): | ||
| """Checks whether polygon segments are correct""" | ||
| poly = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]) | ||
| self.assertEqual( | ||
| poly.as_segments(), | ||
| [ | ||
| Line((0, 0), (1, 0)), | ||
| Line((1, 0), (1, 1)), | ||
| Line((1, 1), (0, 1)), | ||
| Line((0, 1), (0, 0)), | ||
| ], | ||
| ) | ||
| poly = Polygon([(123.23, 35.6), (56.4, 87.45), (43.1, 12.3)]) | ||
| self.assertEqual( | ||
| poly.as_segments(), | ||
| [ | ||
| Line((123.23, 35.6), (56.4, 87.45)), | ||
| Line((56.4, 87.45), (43.1, 12.3)), | ||
| Line((43.1, 12.3), (123.23, 35.6)), | ||
| ], | ||
| ) | ||
| poly = Polygon([[1, 2], [3, 4], [5, 6]]) | ||
| self.assertEqual( | ||
| poly.as_segments(), | ||
| [Line((1, 2), (3, 4)), Line((3, 4), (5, 6)), Line((5, 6), (1, 2))], | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add more tests for invalid argument types and argument number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically you should make sure that this is actually a no arguments method now and in the future
|
I would be thankful if you could add a couple benchmarks as well in the benchmarks directory, though that's not strictly necessary, i can add them later. |
| @overload | ||
| def as_segments(self) -> List[Line]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need @overload here, there's just one way to call this function
Closes #155