#NEWLINE# def test_mutable_geometries( self ) : #NEWLINE# #INDENT# 'Testing the mutability of Polygons and Geometry Collections.' #NEWLINE# for p in self . geometries . polygons : #NEWLINE# #INDENT# poly = fromstr ( p . wkt ) #NEWLINE# self . assertRaises ( TypeError , poly . __setitem__ , 0 , LineString ( ( 1 , 1 ) , ( 2 , 2 ) ) ) #NEWLINE# shell_tup = poly . shell . tuple #NEWLINE# new_coords = [ ] #NEWLINE# for point in shell_tup : #NEWLINE# #INDENT# new_coords . append ( ( ( point [ 0 ] + 500.0 ) , ( point [ 1 ] + 500.0 ) ) ) #NEWLINE# #UNINDENT# new_shell = LinearRing ( * tuple ( new_coords ) ) #NEWLINE# poly . exterior_ring = new_shell #NEWLINE# s = str ( new_shell ) #NEWLINE# self . assertEqual ( poly . exterior_ring , new_shell ) #NEWLINE# self . assertEqual ( poly [ 0 ] , new_shell ) #NEWLINE# #UNINDENT# for tg in self . geometries . multipoints : #NEWLINE# #INDENT# mp = fromstr ( tg . wkt ) #NEWLINE# for i in range ( len ( mp ) ) : #NEWLINE# #INDENT# pnt = mp [ i ] #NEWLINE# new = Point ( random . randint ( 21 , 100 ) , random . randint ( 21 , 100 ) ) #NEWLINE# mp [ i ] = new #NEWLINE# s = str ( new ) #NEWLINE# self . assertEqual ( mp [ i ] , new ) #NEWLINE# self . assertEqual ( mp [ i ] . wkt , new . wkt ) #NEWLINE# self . assertNotEqual ( pnt , mp [ i ] ) #NEWLINE# #UNINDENT# #UNINDENT# for tg in self . geometries . multipolygons : #NEWLINE# #INDENT# mpoly = fromstr ( tg . wkt ) #NEWLINE# for i in xrange ( len ( mpoly ) ) : #NEWLINE# #INDENT# poly = mpoly [ i ] #NEWLINE# old_poly = mpoly [ i ] #NEWLINE# for j in xrange ( len ( poly ) ) : #NEWLINE# #INDENT# r = poly [ j ] #NEWLINE# for k in xrange ( len ( r ) ) : #NEWLINE# #INDENT# r [ k ] = ( ( r [ k ] [ 0 ] + 500.0 ) , ( r [ k ] [ 1 ] + 500.0 ) ) #NEWLINE# #UNINDENT# poly [ j ] = r #NEWLINE# #UNINDENT# self . assertNotEqual ( mpoly [ i ] , poly ) #NEWLINE# mpoly [ i ] = poly #NEWLINE# s = str ( poly ) #NEWLINE# self . assertEqual ( mpoly [ i ] , poly ) #NEWLINE# self . assertNotEqual ( mpoly [ i ] , old_poly )