def test_valid_geometry(self): connection = connections[DEFAULT_DB_ALIAS] # Create path with self-intersection p = PathFactory.build(geom=LineString((0,0,0),(2,0,0),(1,1,0),(1,-1,0))) self.assertRaises(IntegrityError, p.save) # FIXME: Why a regular transaction.rollback does not work??? connection.close() # Clear DB exception at psycopg level # Fix self-intersection p.geom = LineString((0,0,0),(2,0,0),(1,1,0)) p.save() # Update with self-intersection p.geom = LineString((0,0,0),(2,0,0),(1,1,0),(1,-1,0)) self.assertRaises(IntegrityError, p.save) connection.close() # Clear DB exception at psycopg level
def test_valid_geometry(self): connection = connections[DEFAULT_DB_ALIAS] # Create path with self-intersection p = PathFactory.build( geom=LineString((0, 0, 0), (2, 0, 0), (1, 1, 0), (1, -1, 0))) self.assertRaises(IntegrityError, p.save) # TODO: Why a regular transaction.rollback does not work??? connection.close() # Clear DB exception at psycopg level # Fix self-intersection p.geom = LineString((0, 0, 0), (2, 0, 0), (1, 1, 0)) p.save() # Update with self-intersection p.geom = LineString((0, 0, 0), (2, 0, 0), (1, 1, 0), (1, -1, 0)) self.assertRaises(IntegrityError, p.save) connection.close() # Clear DB exception at psycopg level
def test_length(self): p1 = PathFactory.build() self.assertEqual(p1.length, 0) p2 = PathFactory.create() self.assertNotEqual(p2.length, 0)
def test_length(self): p = PathFactory.build() self.assertEqual(p.length, 0) p.save() self.assertNotEqual(p.length, 0)
def test_modify_self_intersection_raises_integrity_error(self): p = PathFactory.build(geom=LineString((0, 0), (2, 0), (1, 1))) p.save() p.geom = LineString((0, 0), (2, 0), (1, 1), (1, -1)) self.assertRaises(IntegrityError, p.save)
def test_valid_geometry_can_be_saved(self): p = PathFactory.build(geom=LineString((0, 0), (2, 0), (1, 1))) p.save()
def test_self_intersection_raises_integrity_error(self): # Create path with self-intersection p = PathFactory.build(geom=LineString((0, 0), (2, 0), (1, 1), (1, -1))) self.assertRaises(IntegrityError, p.save)
def test_modify_self_intersection_raises_integrity_error(self): p = PathFactory.build(geom=LineString((0,0),(2,0),(1,1))) p.save() p.geom = LineString((0,0),(2,0),(1,1),(1,-1)) self.assertRaises(IntegrityError, p.save)
def test_valid_geometry_can_be_saved(self): p = PathFactory.build(geom=LineString((0,0),(2,0),(1,1))) p.save()
def test_self_intersection_raises_integrity_error(self): # Create path with self-intersection p = PathFactory.build(geom=LineString((0,0),(2,0),(1,1),(1,-1))) self.assertRaises(IntegrityError, p.save)