-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Kamparia/dev
gdacs-api v.2 release
- Loading branch information
Showing
9 changed files
with
125 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class GeoJSON(BaseModel): | ||
type: str = "FeatureCollection" | ||
features: list | ||
bbox: list = None | ||
|
||
def __len__(self): | ||
return len(self.features) | ||
|
||
|
||
class Feature(BaseModel): | ||
type: str | ||
properties: dict | ||
geometry: dict | ||
bbox: list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from unittest import TestCase | ||
from gdacs.schemas import * | ||
|
||
|
||
class TestSchemas(TestCase): | ||
def setUp(self) -> None: | ||
pass | ||
|
||
def tearDown(self) -> None: | ||
pass | ||
|
||
def test_geojson(self): | ||
""" | ||
Test the GeoJSON class | ||
:return: | ||
""" | ||
data = GeoJSON(type="FeatureCollection", features=[]) | ||
self.assertIsInstance(data, GeoJSON) | ||
self.assertEqual(data.type, "FeatureCollection") | ||
self.assertEqual(type(data.features), list) | ||
self.assertEqual(len(data), 0) | ||
|
||
def test_feature(self): | ||
""" | ||
Test the Feature class | ||
:return: | ||
""" | ||
data = Feature(type="Feature", properties={}, geometry={}, bbox=[]) | ||
self.assertIsInstance(data, Feature) | ||
self.assertEqual(data.type, "Feature") | ||
self.assertEqual(data.properties, {}) | ||
self.assertEqual(data.geometry, {}) | ||
self.assertEqual(data.bbox, []) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
requests | ||
xmltodict | ||
cachetools | ||
cachetools | ||
pydantic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters