Beispiel #1
0
    def test_merge_key_name(self):
        tableset = TableSet(self.tables.values(), self.tables.keys(), key_name="foo")

        table = tableset.merge()

        self.assertColumnNames(table, ["foo", "letter", "number"])
        self.assertColumnTypes(table, [Text, Text, Number])
Beispiel #2
0
    def test_merge_key_name(self):
        tableset = TableSet(self.tables.values(), self.tables.keys(), key_name='foo')

        table = tableset.merge()

        self.assertColumnNames(table, ['foo', 'letter', 'number'])
        self.assertColumnTypes(table, [Text, Text, Number])
Beispiel #3
0
    def test_merge_key_name(self):
        tableset = TableSet(self.tables.values(), self.tables.keys(), key_name='foo')

        table = tableset.merge()

        self.assertSequenceEqual(table.column_names, ['foo', 'letter', 'number'])
        self.assertIsInstance(table.column_types[0], Text)
        self.assertSequenceEqual(table.column_types[1:], [self.text_type, self.number_type])
Beispiel #4
0
    def test_merge_key_name(self):
        tableset = TableSet(self.tables.values(), self.tables.keys(), key_name='foo')

        table = tableset.merge()

        self.assertSequenceEqual(table.column_names, ['foo', 'letter', 'number'])
        self.assertIsInstance(table.column_types[0], Text)
        self.assertSequenceEqual(table.column_types[1:], [self.text_type, self.number_type])
Beispiel #5
0
    def test_merge_groups(self):
        tableset = TableSet(self.tables.values(), self.tables.keys(), key_name="foo")

        table = tableset.merge(groups=["red", "blue", "green"], group_name="color_code")

        self.assertColumnNames(table, ["color_code", "letter", "number"])
        self.assertColumnTypes(table, [Text, Text, Number])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ["red", "a", 1])
        self.assertSequenceEqual(table.rows[8], ["green", "c", 3])
Beispiel #6
0
    def test_merge(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        table = tableset.merge()

        self.assertColumnNames(table, ['group', 'letter', 'number'])
        self.assertColumnTypes(table, [Text, Text, Number])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ['table1', 'a', 1])
        self.assertSequenceEqual(table.rows[8], ['table3', 'c', 3])
Beispiel #7
0
    def test_merge_groups(self):
        tableset = TableSet(self.tables.values(), self.tables.keys(), key_name='foo')

        table = tableset.merge(groups=['red', 'blue', 'green'], group_name='color_code')

        self.assertColumnNames(table, ['color_code', 'letter', 'number'])
        self.assertColumnTypes(table, [Text, Text, Number])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ['red', 'a', 1])
        self.assertSequenceEqual(table.rows[8], ['green', 'c', 3])
Beispiel #8
0
    def test_merge(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        table = tableset.merge()

        self.assertColumnNames(table, ['group', 'letter', 'number'])
        self.assertColumnTypes(table, [Text, Text, Number])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ['table1', 'a', 1])
        self.assertSequenceEqual(table.rows[8], ['table3', 'c', 3])
Beispiel #9
0
    def test_merge(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        table = tableset.merge()

        self.assertColumnNames(table, ["group", "letter", "number"])
        self.assertColumnTypes(table, [Text, Text, Number])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ["table1", "a", 1])
        self.assertSequenceEqual(table.rows[8], ["table3", "c", 3])
Beispiel #10
0
    def test_merge(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        table = tableset.merge()

        self.assertSequenceEqual(table.column_names, ['group', 'letter', 'number'])
        self.assertIsInstance(table.column_types[0], Text)
        self.assertSequenceEqual(table.column_types[1:], [self.text_type, self.number_type])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ['table1', 'a', 1])
        self.assertSequenceEqual(table.rows[8], ['table3', 'c', 3])
Beispiel #11
0
    def test_merge(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        table = tableset.merge()

        self.assertSequenceEqual(table.column_names, ["group", "letter", "number"])
        self.assertIsInstance(table.column_types[0], Text)
        self.assertSequenceEqual(table.column_types[1:], [self.text_type, self.number_type])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ["table1", "a", 1])
        self.assertSequenceEqual(table.rows[8], ["table3", "c", 3])
Beispiel #12
0
    def test_merge(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        table = tableset.merge()

        self.assertSequenceEqual(table.column_names, ['group', 'letter', 'number'])
        self.assertIsInstance(table.column_types[0], Text)
        self.assertSequenceEqual(table.column_types[1:], [self.text_type, self.number_type])

        self.assertEqual(len(table.rows), 9)
        self.assertSequenceEqual(table.rows[0], ['table1', 'a', 1])
        self.assertSequenceEqual(table.rows[8], ['table3', 'c', 3])
Beispiel #13
0
    def test_merge_groups_invalid_type(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        with self.assertRaises(ValueError):
            tableset.merge(groups='invalid', group_name='color_code')
Beispiel #14
0
    def test_merge_groups_invalid_length(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        with self.assertRaises(ValueError):
            tableset.merge(groups=['red', 'blue'], group_name='color_code')
Beispiel #15
0
    def test_merge_groups_invalid_type(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        with self.assertRaises(ValueError):
            table = tableset.merge(groups='invalid', group_name='color_code')  # noqa
Beispiel #16
0
    def test_merge_groups_invalid_length(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        with self.assertRaises(ValueError):
            table = tableset.merge(groups=["red", "blue"], group_name="color_code")  # noqa
Beispiel #17
0
    def test_merge_groups_invalid_length(self):
        tableset = TableSet(self.tables.values(), self.tables.keys())

        with self.assertRaises(ValueError):
            table = tableset.merge(groups=['red', 'blue'], group_name='color_code')