예제 #1
0
파일: test_table.py 프로젝트: oiesis/agate
    def test_compute_with_row_names(self):
        table = Table(self.rows, self.columns, row_names='three')

        new_table = table.compute([
            (Formula(self.number_type, lambda r: r['two'] + r['three']), 'number'),
            (Formula(self.text_type, lambda r: (r['one'] or '-') + six.text_type(r['three'])), 'text')
        ])

        self.assertSequenceEqual(new_table.rows[0], ('a', 2, 3, 4, 5, 'a3'))
        self.assertSequenceEqual(new_table.row_names, (3, 5, 4, 6))
예제 #2
0
파일: test_table.py 프로젝트: wpdavis/agate
    def test_compute_with_row_names(self):
        table = Table(self.rows, self.columns, row_names='three')

        new_table = table.compute([
            (Formula(self.number_type,
                     lambda r: r['two'] + r['three']), 'number'),
            (Formula(self.text_type, lambda r:
                     (r['one'] or '-') + six.text_type(r['three'])), 'text')
        ])

        self.assertSequenceEqual(new_table.rows[0], ('a', 2, 3, 4, 5, 'a3'))
        self.assertSequenceEqual(new_table.row_names, (3, 5, 4, 6))
예제 #3
0
파일: test_table.py 프로젝트: wpdavis/agate
    def test_compute_creates_rows(self):
        table = Table(self.rows, self.columns)
        table2 = table.compute([(Formula(self.number_type,
                                         lambda r: r['one']), 'new2')])
        table3 = table2.compute([(Formula(self.number_type,
                                          lambda r: r['one']), 'new3')])

        self.assertIsNot(table.rows[0], table2.rows[0])
        self.assertNotEqual(table.rows[0], table2.rows[0])
        self.assertIsNot(table2.rows[0], table3.rows[0])
        self.assertNotEqual(table2.rows[0], table3.rows[0])
        self.assertSequenceEqual(table.rows[0], (1, 4, 'a'))
예제 #4
0
파일: test_table.py 프로젝트: oiesis/agate
    def test_compute_creates_rows(self):
        table = Table(self.rows, self.columns)
        table2 = table.compute([
            (Formula(self.number_type, lambda r: r['one']), 'new2')
        ])
        table3 = table2.compute([
            (Formula(self.number_type, lambda r: r['one']), 'new3')
        ])

        self.assertIsNot(table.rows[0], table2.rows[0])
        self.assertNotEqual(table.rows[0], table2.rows[0])
        self.assertIsNot(table2.rows[0], table3.rows[0])
        self.assertNotEqual(table2.rows[0], table3.rows[0])
        self.assertSequenceEqual(table.rows[0], (1, 4, 'a'))