-
Notifications
You must be signed in to change notification settings - Fork 119
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
Added count_documents() implementation to builtin_timeseries #935
Changes from 5 commits
3c92c4b
776ba50
c4ea9a8
e773c34
bb88af4
821478c
177c45b
0903cf7
825d4ce
9d4063f
ac619ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,30 @@ def testExtraQueries(self): | |
with self.assertRaises(AttributeError): | ||
list(ts.find_entries(time_query=tq, extra_query_list=[ignored_phones])) | ||
|
||
def testFindEntriesCount(self): | ||
''' | ||
Test: Specific keys with other parameters not passed values. | ||
Input: For each dataset: ["background/location", "background/filtered_location] | ||
- Testing this with sample dataset: "shankari_2015-aug-21", "shankari_2015-aug-27" | ||
Output: Aug_21: [738, 508], Aug_27: [555, 327] | ||
- Actual output just returns a single number for count of entries. | ||
- Validated using grep count of occurrences for keys: 1) "background/location" 2) "background/filtered_location" | ||
- $ grep -c <key> <dataset>.json | ||
''' | ||
ts1_aug_21 = esta.TimeSeries.get_time_series(self.testUUID1) | ||
ts2_aug_27 = esta.TimeSeries.get_time_series(self.testUUID) | ||
|
||
count_ts1 = [ts1_aug_21.find_entries_count(key="background/location"), ts1_aug_21.find_entries_count(key="background/filtered_location")] | ||
print("\nEntry counts for location, filtered_location on {} = {}".format("Aug_21", count_ts1)) | ||
self.assertEqual(count_ts1, [738, 508]) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are very basic tests - I don't see any corner-case testing, for example.
I believe you had listed out a few similar cases during our discussion, I don't see any actual implementation of those here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had not implemented for blank keys as it was to be decided whether key is to be made mandatory or not and assumed that a key would always be passed for getting count. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a doubt, regarding
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see #935 (comment) |
||
count_ts2 = [ts2_aug_27.find_entries_count(key="background/location"), ts2_aug_27.find_entries_count(key="background/filtered_location")] | ||
print("Entry counts for location, filtered_location on {} = {}".format("Aug_27", count_ts2)) | ||
self.assertEqual(count_ts2, [555, 327]) | ||
|
||
print("Assert Test for Count Data successful!") | ||
|
||
|
||
if __name__ == '__main__': | ||
import emission.tests.common as etc | ||
etc.configLogging() | ||
|
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 please add the
grep
outputs here?