Exemple #1
0
    def test_move_rows(self):
        table1 = self.table
        table2 = Table.add_root(widgy_site)

        table1.header.add_child(widgy_site, TableHeaderData)
        table2.header.add_child(widgy_site, TableHeaderData)
        row = table2.body.add_child(widgy_site, TableRow)

        self.assertEqual(table2.body.get_children(), [row])
        self.assertEqual(table1.body.get_children(), [])
        # a row can be moved to another table with the same number of rows
        row.reposition(widgy_site, parent=table1.body)
        self.assertEqual(table1.body.get_children(), [row])
        self.assertEqual(table2.body.get_children(), [])

        # but not a table with a different number of rows
        table2.header.add_child(widgy_site, TableHeaderData)
        with self.assertRaises(ParentChildRejection):
            row.reposition(widgy_site, parent=table2.body)
Exemple #2
0
    def test_move_rows(self):
        table1 = self.table
        table2 = Table.add_root(widgy_site)

        table1.header.add_child(widgy_site, TableHeaderData)
        table2.header.add_child(widgy_site, TableHeaderData)
        row = table2.body.add_child(widgy_site, TableRow)

        self.assertEqual(table2.body.get_children(), [row])
        self.assertEqual(table1.body.get_children(), [])
        # a row can be moved to another table with the same number of rows
        row.reposition(widgy_site, parent=table1.body)
        self.assertEqual(table1.body.get_children(), [row])
        self.assertEqual(table2.body.get_children(), [])

        # but not a table with a different number of rows
        table2.header.add_child(widgy_site, TableHeaderData)
        with self.assertRaises(ParentChildRejection):
            row.reposition(widgy_site, parent=table2.body)
Exemple #3
0
 def setUp(self):
     self.table = Table.add_root(widgy_site)
Exemple #4
0
 def setUp(self):
     self.table = Table.add_root(widgy_site)