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

Missed case in assignment checking #285

Merged
merged 3 commits into from Mar 18, 2019
Merged

Missed case in assignment checking #285

merged 3 commits into from Mar 18, 2019

Conversation

zschutzman
Copy link
Contributor

The stuff I wrote yesterday doesn't handle the case where all of the unit names are correct, but the assignment has some unit in more than one district. This checks for that problem as well.

@maxhully
Copy link
Contributor

We should add tests covering these behaviors too.

@zschutzman
Copy link
Contributor Author

I don't think that this last case is even reachable in the current setup, since the constructor inverts a dictionary of the form {vertex : assn}, and a vertex can't appear as a key more than once, so it will never be in two different sets in the reversed dictionary. It may become an issue as more kinds of i/o are allowed and we need to worry about a user accidentally modifying the second column of a csv, for example.

I can write a test function to try the first two cases (not every vertex has an assignment; dictionary names are different from vertex names).

@maxhully
Copy link
Contributor

Good point! Then we should probably rearrange things so that case raises an exception.

added tests for vertex names not matching the names
in the assignment and the assignment not covering all
vertices
@zschutzman
Copy link
Contributor Author

I wrote three test functions. The first two check that doing something bad with standard methods causes an error. The third verifies that the validate_assignment() method is catching the case where some vertex belongs to more than one district, even though this is not reachable in the typical workflow.

@maxhully maxhully merged commit b7f0289 into mggg:master Mar 18, 2019
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

2 participants