コード例 #1
0
ファイル: test_shapefile.py プロジェクト: nathania/pysal
 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
ファイル: test_shapefile.py プロジェクト: PepSalehi/pysal
 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
ファイル: test_shapefile.py プロジェクト: nathania/pysal
 def test_close(self):
     shx = shx_file(pysal.examples.get_path('Point.shx'))
     shx.close(None)
     self.assertEqual(shx.fileObj.closed, True)
コード例 #4
0
ファイル: test_shapefile.py プロジェクト: nathania/pysal
 def test___init__(self):
     shx = shx_file(pysal.examples.get_path('Point.shx'))
     assert isinstance(shx, shx_file)
コード例 #5
0
ファイル: test_shapefile.py プロジェクト: PepSalehi/pysal
 def test_close(self):
     shx = shx_file(pysal.examples.get_path('Point'))
     shx.close(None)
     self.assertEqual(shx.fileObj.closed, True)
コード例 #6
0
ファイル: test_shapefile.py プロジェクト: PepSalehi/pysal
 def test___init__(self):
     shx = shx_file(pysal.examples.get_path('Point'))
     assert isinstance(shx, shx_file)