示例#1
0
 def test_normal_geojson(self):
     with open("TestFiles/normal.geojson", "rb") as file:
         res = run.process_document(file.read())
     true_dict = {
         "Point": 10,
         "MultiPoint": 0,
         "LineString": 2,
         "MultiLineString": 0,
         "Polygon": 3,
         "MultiPolygon": 0
     }
     self.assert_func(res, true_dict, "Normal GeoJSON")
示例#2
0
 def test_single_geojson(self):
     with open("TestFiles/single_geom.geojson", "rb") as file:
         res = run.process_document(file.read())
     true_dict = {
         "Point": 1,
         "MultiPoint": 0,
         "LineString": 0,
         "MultiLineString": 0,
         "Polygon": 0,
         "MultiPolygon": 0
     }
     self.assert_func(res, true_dict, "Single geometry object")
示例#3
0
    def test_document_not_json(self):
        with open("TestFiles/archive.zip", "rb") as file:
            res = run.process_document(file.read())
        self.assert_func(res, STR_NOT_VALID_JSON, "Archive file")

        with open("TestFiles/desert.jpg", "rb") as file:
            res = run.process_document(file.read())
        self.assert_func(res, STR_NOT_VALID_JSON, "Image file")

        with open("TestFiles/presentation.pptx", "rb") as file:
            res = run.process_document(file.read())
        self.assert_func(res, STR_NOT_VALID_JSON, "Presentation file")

        with open("TestFiles/Test.docx", "rb") as file:
            res = run.process_document(file.read())
        self.assert_func(res, STR_NOT_VALID_JSON, "Docx file")

        with open("TestFiles/Test.pdf", "rb") as file:
            res = run.process_document(file.read())
        self.assert_func(res, STR_NOT_VALID_JSON, "PDF file")

        with open("TestFiles/text.txt", "rb") as file:
            res = run.process_document(file.read())
        self.assert_func(res, STR_NOT_VALID_JSON, "Text file")
示例#4
0
 def test_not_geojson(self):
     with open("TestFiles/not_geojson.geojson", "rb") as file:
         res = run.process_document(file.read())
     self.assert_func(res, STR_NOT_VALID_JSON, "Not GeoJSON")