def test_staging(self): network = Constructor() network.set_grid(5, 5, 100) network.delete_connection(0, 1) with self.assertRaises( AssertionError): # no moving after deleting street network.move_horizontal_line(0, 10) with self.assertRaises(AssertionError): network.move_vertical_line(0, 10) network.modify_adjacency(10, 0.5, 0.5) with self.assertRaises(AssertionError): # no moving after modifying network.move_vertical_line(0, 10) with self.assertRaises(AssertionError): network.move_horizontal_line(0, 10) with self.assertRaises(AssertionError): # no deleting after modifying network.delete_connection(0, 1)
def test_move_horizontal_line(self): # Test normal usage network1 = Constructor() network1.set_grid(4, 4, 100) network1.move_horizontal_line(2, 50) positions1 = network1.get_positions() for i in range(2 * 4, 3 * 4): self.assertEqual(positions1[i][1], 250) network2 = Constructor() network2.set_grid(5, 5, 100) network2.move_horizontal_line(0, -10) positions2 = network2.get_positions() for i in range(0, 5): self.assertEqual(positions2[i][1], -10) # Test wrong usage with self.assertRaises(ValueError): # no such horizontal line network1.move_horizontal_line(-1, 0) with self.assertRaises(ValueError): # no such horizontal line network2.move_horizontal_line(5, 0)