Ejemplo n.º 1
0
 def test_removeRows_single_row(self):
     map_value = Map(["a"], [1.1])
     model = MapModel(map_value)
     self.assertTrue(model.removeRows(0, 1))
     self.assertEqual(model.rowCount(), 1)
     self.assertEqual(model.columnCount(), 1)
     self.assertEqual(model.index(0, 0).data(), "")
Ejemplo n.º 2
0
 def test_removeRows_middle_row_in_nested_map(self):
     nested_map = Map(["a", "b", "c"], [1.1, 2.2, 3.3])
     map_value = Map(["A"], [nested_map])
     model = MapModel(map_value)
     self.assertTrue(model.removeRows(1, 1))
     self.assertEqual(model.rowCount(), 3)
     expected_table = [["A", "a", 1.1, ""], ["A", "c", 3.3, ""],
                       ["", "", "", ""]]
     for y, row in enumerate(expected_table):
         for x, expected in enumerate(row):
             self.assertEqual(model.index(y, x).data(), expected)
Ejemplo n.º 3
0
 def test_removeRows_last_row(self):
     map_value = Map(["a", "b"], [1.1, 2.2])
     model = MapModel(map_value)
     self.assertTrue(model.removeRows(0, 1))
     self.assertEqual(model.rowCount(), 2)
     self.assertEqual(model.index(0, 0).data(), "b")
     self.assertEqual(model.index(0, 1).data(), 2.2)
     self.assertEqual(model.index(0, 2).data(), "")
     self.assertEqual(model.index(1, 0).data(), "")
     self.assertEqual(model.index(1, 1).data(), "")
     self.assertEqual(model.index(1, 2).data(), "")