Exemplo n.º 1
0
    def test_dict_iter_of_integers(self):
        iterable = Result({'a': 2, 'b': 3, 'c': None}, dict)
        result = _apply_to_data(_sqlite_max, iterable)

        self.assertIsInstance(result, Result)
        self.assertEqual(result.evaluation_type, dict)
        self.assertEqual(result.fetch(), {'a': 2, 'b': 3, 'c': None})
Exemplo n.º 2
0
    def test_dict_iter_of_lists(self):
        iterable = Result({'a': [1, None], 'b': ['x', None, 0]}, dict)
        result = _apply_to_data(_sqlite_count, iterable)

        self.assertIsInstance(result, Result)
        self.assertEqual(result.evaluation_type, dict)
        self.assertEqual(result.fetch(), {'a': 1, 'b': 2})
Exemplo n.º 3
0
    def test_dict_iter_of_integers(self):
        iterable = Result({'a': -5, 'b': None, 'c': 'xyz'}, dict)
        result = _apply_to_data(_sqlite_count, iterable)

        self.assertIsInstance(result, Result)
        self.assertEqual(result.evaluation_type, dict)
        self.assertEqual(result.fetch(), {'a': 1, 'b': 0, 'c': 1})
Exemplo n.º 4
0
    def test_dict_iter_of_lists(self):
        iterable = Result({'a': [1, 2], 'b': [3, 4]}, dict)
        result = _apply_to_data(_sqlite_sum, iterable)

        self.assertIsInstance(result, Result)
        self.assertEqual(result.evaluation_type, dict)
        self.assertEqual(result.fetch(), {'a': 3, 'b': 7})
Exemplo n.º 5
0
    def test_dict_iter_of_lists(self):
        iterable = Result(
            {
                'a': [1, 2, 3],
                'b': [None, 1, 2, 3, 'xx'],
                'c': [None, None]
            }, dict)
        result = _apply_to_data(_sqlite_max, iterable)

        self.assertIsInstance(result, Result)
        self.assertEqual(result.evaluation_type, dict)
        self.assertEqual(result.fetch(), {'a': 3, 'b': 'xx', 'c': None})