예제 #1
0
 def test_add_record(self):
     shx = shx_file(pysal.examples.get_path('Point.shx'))
     expectedIndex = [(100, 20), (128, 20), (156, 20), (184, 20), (212, 20),
                      (240, 20), (268, 20), (296, 20), (324, 20)]
     assert shx.index == expectedIndex
     shx2 = shx_file('test', 'w')
     for i, rec in enumerate(shx.index):
         id, location = shx2.add_record(rec[1])
         assert id == (i + 1)
         assert location == rec[0]
     assert shx2.index == shx.index
     shx2.close(shx._header)
     new_shx = open('test.shx', 'rb').read()
     expected_shx = open(pysal.examples.get_path('Point.shx'), 'rb').read()
     assert new_shx == expected_shx
     os.remove('test.shx')
예제 #2
0
 def test_add_record(self):
     shx = shx_file(pysal.examples.get_path('Point'))
     expectedIndex = [(100, 20), (128, 20), (156, 20),
                      (184, 20), (212, 20), (240, 20),
                      (268, 20), (296, 20), (324, 20)]
     assert shx.index == expectedIndex
     shx2 = shx_file('test', 'w')
     for i, rec in enumerate(shx.index):
         id, location = shx2.add_record(rec[1])
         assert id == (i + 1)
         assert location == rec[0]
     assert shx2.index == shx.index
     shx2.close(shx._header)
     new_shx = open('test.shx', 'rb').read()
     expected_shx = open(pysal.examples.get_path('Point.shx'), 'rb').read()
     assert new_shx == expected_shx
     os.remove('test.shx')
예제 #3
0
 def test_close(self):
     shx = shx_file(pysal.examples.get_path('Point.shx'))
     shx.close(None)
     self.assertEqual(shx.fileObj.closed, True)
예제 #4
0
 def test___init__(self):
     shx = shx_file(pysal.examples.get_path('Point.shx'))
     assert isinstance(shx, shx_file)
예제 #5
0
 def test_close(self):
     shx = shx_file(pysal.examples.get_path('Point'))
     shx.close(None)
     self.assertEqual(shx.fileObj.closed, True)
예제 #6
0
 def test___init__(self):
     shx = shx_file(pysal.examples.get_path('Point'))
     assert isinstance(shx, shx_file)