Exemplo n.º 1
0
 def test_should_fail_if_invalid_length_of_arguments(self):
     with self.assertRaisesRegexp(GroupByException,
                                  "Invalid args length: 2, must be a 3 .*"):
         TimeGroupBy.from_arguments(('invalid', 'length'))
Exemplo n.º 2
0
 def test_should_fail_if_arguments_are_not_list(self):
     with self.assertRaisesRegexp(
             GroupByException,
             "Invalid args type: <type 'str'>, must be a list or tuple."):
         TimeGroupBy.from_arguments('not_a_list')
Exemplo n.º 3
0
    def test_from_arguments(self):
        group_by = TimeGroupBy.from_arguments((2, 'days', 500))

        self.assertEqual(group_by.range_value, 2)
        self.assertEqual(group_by.range_unit, 'days')
        self.assertEqual(group_by.group_count, 500)
 def test_should_fail_if_invalid_length_of_arguments(self):
     with self.assertRaisesRegexp(GroupByException, "Invalid args length: 2, must be a 3 .*"):
         TimeGroupBy.from_arguments(('invalid', 'length'))
 def test_should_fail_if_arguments_are_not_list(self):
     with self.assertRaisesRegexp(GroupByException, "Invalid args type: <type 'str'>, must be a list or tuple."):
         TimeGroupBy.from_arguments('not_a_list')
    def test_from_arguments(self):
        group_by = TimeGroupBy.from_arguments((2, 'days', 500))

        self.assertEqual(group_by.range_value, 2)
        self.assertEqual(group_by.range_unit, 'days')
        self.assertEqual(group_by.group_count, 500)