tests(#2406): add test_deck.py#2580
Conversation
d3177ca to
d5b2b3d
Compare
| m.add_layer("https://example.com/tiles2/{z}/{x}/{y}.png", layer_name="layer2") | ||
| self.assertEqual(len(m.layers), 2) | ||
|
|
||
| def test_layer_class_exists(self): |
There was a problem hiding this comment.
I don't think these hasattr and issubclass are providing useful test coverage. Why are they needed?
There was a problem hiding this comment.
You're right, they're not needed, the other tests already exercise those classes and methods. I'll remove them.
| self.assertIsNotNone(m) | ||
| self.assertEqual(m.initial_view_state.height, 600) | ||
|
|
||
| def test_map_default_center(self): |
There was a problem hiding this comment.
Please combine all the tests that only have this one line into test_map_init_default_params:
m = deck.Map(ee_initialize=False)That looks to be test_map_default_center, test_map_default_zoom, test_map_default_height, test_map_default_map_style, test_map_layers_initially_empty
e138aeb to
a1cc731
Compare
for more information, see https://pre-commit.ci
schwehr
left a comment
There was a problem hiding this comment.
For future changes, please just do additional commits on top of what is reviewed. That way the changes are more obvious to the reviewer. I will do a squash and merge at the end so extra commits will not appear in the final history.
I think after this one last change, the PR should be good to go.
Thank you!
|
|
||
| def test_map_init_custom_center(self): | ||
| m = deck.Map(ee_initialize=False, center=(40, -100)) | ||
| self.assertIsNotNone(m) |
There was a problem hiding this comment.
Remove the self.assertIsNotNone(m) from here to the end. If for some odd reason deck.Map(...) returns None, the first access of m. will catch that. It will be a slightly messier error message, but that will keep the test code easier to follow as it grows.
Summary
Adds unit tests for the
deckmodule as requested in #2406.Changes
ee_initialize=Falseto avoid Earth Engine dependencyVerification
python -m unittest discover -v tests test_deck.py
All 19 tests pass locally.
Continuation of #2575, following the incremental PR approach as by @schwehr.