Skip to content
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

Increase the test coverage of maps.py in test_maps.py #603

Merged
merged 4 commits into from Dec 26, 2023

Conversation

NhienPhan2909
Copy link

[x] Wrote test for feature
[ ] Added changes to CHANGELOG.md
[ ] Bumped version number (delete if unneeded)

Changes proposed:
Try to increase the test coverage of maps.py to as close to 100% as possible.

Copy link
Member

@adnanhemani adnanhemani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this - this is very needed.

But the unit tests are failing. Can you please take a look at the unit test results on this PR? It may help you to run the tests locally first to ensure that the tests aren't failing when you push to the PR. Please let me know if you have any questions - thank you!

values = [1, 2, 3, 4, 5]
ids = ['id1', 'id2', 'id3']
colored = states.color(values, ids)
assert ids == list(range(len(values)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we please just list the final value we expect rather than copying the logic from the source code?

}
region = ds.Region(geojson_data)
# Call the geojson method with a new feature_id
updated_geojson = region.geojson("new_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the new id named "test_id" above? Am I missing something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't understand the code earlier, makes sense now.

@coveralls
Copy link

coveralls commented Dec 19, 2023

Coverage Status

coverage: 94.935% (+1.4%) from 93.495%
when pulling 20b19fe on NhienPhan2909:map_test
into 2c706e2 on data-8:master.

Copy link
Member

@adnanhemani adnanhemani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After making the requested changes myself, this now looks good to me. But since I've done non-trivial work on this PR, I'd request @davidwagner to please review this first. I'll try to fill in the remaining untested code in a separate PR once this merges.

}
region = ds.Region(geojson_data)
# Call the geojson method with a new feature_id
updated_geojson = region.geojson("new_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't understand the code earlier, makes sense now.

@davidwagner
Copy link
Member

This looks good to me! Thank you. I appreciate all the tests and the bugfix in Map.read_geojson(). (Side note: I never noticed the semantics of Map.overlay(Map) before...)

@davidwagner davidwagner merged commit 9a200e0 into data-8:master Dec 26, 2023
2 checks passed
@davidwagner
Copy link
Member

@adnanhemani Merged. Thank you for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants