-
Notifications
You must be signed in to change notification settings - Fork 16
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
Filter current dataset subindicators #276
Conversation
This will only fetch/create subindicators for filter values from the current dataset
Test if new dataset will not use subindicators from other datasets
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.
can we add another test where the new dataset get's another "upload" so another datasetdata and then the groups will have both subindicators but not from the other datasets?
tests/datasets/test_dataloader.py
Outdated
@@ -263,3 +263,19 @@ def test_subindicators_update(self, dataset, datasetData, subindicatorGroup): | |||
assert len(groups) == 2 | |||
assert groups[0].subindicators == ["A", "B", "C"] | |||
assert groups[1].subindicators == ["X", "Y"] | |||
|
|||
def test_new_dataset(self, dataset, datasetData, subindicatorGroup): | |||
dataset = DatasetFactory() |
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.
can you rename dataset
to something else like new_dataset
just to make it clear this is a different dataset then the fixture.
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.
@michaelglenister dataloader code looks good to me but i think test needs one more dataset and DatasetData object to test actual results.
In this test we should be testing what happens if there are DatasetData objects that belongs to different datasets but have same group with diff values.
Previously it was merging subindicator values in respective to the dataset.
Add comment to explain unit test and rename the method
Add checks to see if the previous dataset is effected after adding a new dataset
I added additional checks to test that subindicators are not leaking between datasets using the same group names |
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.
almost there :)
tests/datasets/test_dataloader.py
Outdated
|
||
assert len(groups) == 2 | ||
assert groups[0].subindicators == ["D"] | ||
assert groups[0].subindicators != ["A", "B", "C", "D"] |
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.
not quite right.
datasetData
creates two subindicators A
and B
but not C
so this will never be the case.
def test_old_dataset_does_not_include_new_subindicators(self, dataset, datasetData, subindicatorGroup): | ||
# Make sure same group names from a previous dataset does not have subindicators leaking into it | ||
|
||
DatasetDataFactory( |
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.
this is not the right test, this does not create a new dataset.
You should do the same as in above test:
new_dataset = DatasetFactory()
DatasetDataFactory(dataset=new_dataset, data={'group1': 'D', 'group2': 'Z' } )
otherwise D and Z will never be there and cannot leak into the old group with the same name.
Fixed remaining issues with the new test cases
the tests were updated according to your review and mine.
This will only fetch/create sub-indicators for filter values from the current dataset
Description
Related Issue
OpenUpSA/wazimap-ng-ui#346
https://trello.com/c/SWt9HuT3/733-productionise-vega-and-data-branch
How to test it locally
Upload a dataset and check if group ordering contains unexpected filter values
Changelog
Added
Updated
Removed
Checklist
Pull Request
Commits
Code Quality
Testing