Conversation
|
It seems like you are falling foul of flake8's doctoring checks, so it isn't passing CI. Me and David turned off doc string checks for tests in |
|
@jacobcook1995 I think there are two problems here: one is that of missing docstrings, the other is of malformed docstrings. You might want to disable the former for tests (though personally I wouldn't -- you really should have a comments saying what each of your tests do anyway, so why not just make them docstrings?) but I think malformed docstrings are a code style problem like any other and should just be fixed. Most of the "public" functions you have won't really be used by end users anyway, but it's still worth having docstrings for them as internal documentation. Same applies to tests. |
|
It looks like the tests are failing on the CI system because You need to run |
| assert distance == pytest.approx(distance2) | ||
|
|
||
| # check angle between corner points is the same | ||
| from math import atan2, degrees, pi |
There was a problem hiding this comment.
A simpler approach would be to calculate the inner product of the two segments and check if it is zero. So, if AB and AC are numpy arrays that go from point A to B and point A to C respectively, then they will form a ±90 deg angle if:
assert np.inner(AB, AC) == pytest.approx(0)If you need specifically the angle (which you do for the hexagonal one), you can follow an approach like this: https://www.atqed.com/numpy-vector-angle
There was a problem hiding this comment.
I replaced the initial checks for angles with this approach, thanks for the suggestion
Codecov Report
@@ Coverage Diff @@
## develop #59 +/- ##
============================================
+ Coverage 0.00% 75.86% +75.86%
============================================
Files 3 3
Lines 58 58
============================================
+ Hits 0 44 +44
+ Misses 58 14 -44
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Description
Added tests for CoreGrid constructor, make_square_grid, and make_hex_grid functions in core.py.
Fixes #31 (partly)
Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks