def test_increment(self): genders = EZDict() manual = {} for item in small_data: genders.incrementer(EZDict(item).gender) if item["gender"] in manual: manual[item["gender"]] += 1 else: manual[item["gender"]] = 1 self.assertEqual(manual, genders)
def test_group_by_nested_count(self): ez = EZDict() for item in small_data: ez.incrementer(round(EZDict(item).favoriteFruit.apple, 1)) self.assertEqual(ez, Query("$group_by('favoriteFruit.apple.$round(1)', true)").single(small_data))