Skip to content
Snippets Groups Projects
test_shp_format.py 933 B
Newer Older
  • Learn to ignore specific revisions
  • Jesper Zedlitz's avatar
    Jesper Zedlitz committed
    import unittest
    from formats.shp_format import is_valid
    
    
    class TestShpFormat(unittest.TestCase):
        def test_is_valid__valid(self):
            resource = {}
            with open("tests/data/bermuda.zip", "r") as file:
                self.assertTrue(is_valid(resource, file))
    
        def test_is_valid__multi_layer(self):
            resource = {}
            with open("tests/data/zos116.zip", "r") as file:
                self.assertTrue(is_valid(resource, file))
    
        def test_is_valid__sub_directory(self):
            """The ZIP file contains a subdirectory for the only layer."""
            resource = {}
            with open("tests/data/bermuda-with-subdir.zip", "r") as file:
                self.assertTrue(is_valid(resource, file))
    
        def test_is_valid__invalid(self):
            resource = {}
            with open("tests/data/json-in-zip.zip", "r") as file:
                self.assertFalse(is_valid(resource, file))
    
    
    if __name__ == "__main__":
        unittest.main()