Esempio n. 1
0
    def test_all(self):
        rows = [
            Row([True], ['test']),
            Row([True], ['test']),
            Row([None], ['test']),
        ]
        column = Column(0, 'test', Boolean(), rows)
        self.assertEqual(column.aggregate(All()), False)

        rows = [
            Row([True], ['test']),
            Row([True], ['test']),
            Row([True], ['test']),
        ]
        column = Column(0, 'test', Boolean(), rows)
        self.assertEqual(column.aggregate(All()), True)
Esempio n. 2
0
    def test_all(self):
        rows = [
            Row([True], ['test']),
            Row([True], ['test']),
            Row([None], ['test']),
        ]
        column = Column(0, 'test', Boolean(), rows)
        self.assertEqual(column.aggregate(All()), False)

        rows = [
            Row([True], ['test']),
            Row([True], ['test']),
            Row([True], ['test']),
        ]
        column = Column(0, 'test', Boolean(), rows)
        self.assertEqual(column.aggregate(All()), True)
Esempio n. 3
0
    def test_max_length(self):
        rows = [
            Row(['a'], ['test']),
            Row(['gobble'], ['test']),
            Row(['w'], ['test']),
        ]

        column = Column(0, 'test', Text(), rows)
        self.assertEqual(column.aggregate(MaxLength()), 6)
Esempio n. 4
0
    def test_max_length(self):
        rows = [
            Row(['a'], ['test']),
            Row(['gobble'], ['test']),
            Row(['w'], ['test']),
        ]

        column = Column(0, 'test', Text(), rows)
        self.assertEqual(column.aggregate(MaxLength()), 6)
Esempio n. 5
0
    def test_max(self):
        rows = [
            Row([datetime.datetime(1994, 3, 3, 6, 31)], ['test']),
            Row([datetime.datetime(1994, 3, 3, 6, 30, 30)], ['test']),
            Row([datetime.datetime(1994, 3, 3, 6, 30)], ['test']),
        ]

        column = Column(0, 'test', DateTime(), rows)

        self.assertIsInstance(Max().get_aggregate_data_type(column), DateTime)
        self.assertEqual(column.aggregate(Max()), datetime.datetime(1994, 3, 3, 6, 31))
Esempio n. 6
0
    def test_max_length_invalid(self):
        column = Column(0, 'test', Number(), ([1], [2], [3]))

        with self.assertRaises(DataTypeError):
            column.aggregate(MaxLength())
Esempio n. 7
0
    def test_max_length_invalid(self):
        column = Column(0, 'test', Number(), ([1], [2], [3]))

        with self.assertRaises(DataTypeError):
            column.aggregate(MaxLength())