Skip to content

Commit

Permalink
Fix geopoint with a constraint bug (#356)
Browse files Browse the repository at this point in the history
* Added failing test

* Upgrade to [email protected]
  • Loading branch information
roll authored Apr 23, 2020
1 parent 6014181 commit cb3fe71
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
4 changes: 4 additions & 0 deletions data/datapackages/geopoint/data/geopoint-object.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Office,Location
Dalby,"{""lon"": 151.2660, ""lat"": -27.1944}"
Kingaroy,"{""lon"": 151.833333, ""lat"": -26.533333}"
Toowoomba,"{""lon"": 151.95, ""lat"": -27.566667}"
54 changes: 54 additions & 0 deletions data/datapackages/geopoint/datapackage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"profile": "tabular-data-package",
"resources": [
{
"profile": "tabular-data-resource",
"encoding": "utf-8",
"schema": {
"fields": [
{
"name": "Office",
"type": "string",
"format": "default",
"constraints": {
"required": true,
"unique": true
}
},
{
"name": "Location",
"type": "geopoint",
"format": "object",
"constraints": {
"required": true
}
}
],
"missingValues": [
""
]
},
"format": "csv",
"mediatype": "text/csv",
"sources": [
{
"title": "",
"path": "",
"email": ""
}
],
"name": "office-locations",
"title": "Office locations",
"description": "Offices locations described using geopoint object",
"path": "data/geopoint-object.csv"
}
],
"sources": [
{
"title": "",
"path": "",
"email": ""
}
],
"name": "office-locations-geopoint-object"
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def read(*paths):
'simpleeval>=0.9',
'statistics>=1.0',
'tabulator>=1.29',
'tableschema>=1.10',
'tableschema>=1.16',
'datapackage>=1.10',
]
INSTALL_FORMAT_ODS_REQUIRES = [
Expand Down
5 changes: 5 additions & 0 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,8 @@ def test_validate_datapackage_with_schema_structure_only_issue_348(log):
}
report = validate(DESCRIPTOR, checks=['structure'])
assert report['valid']


def test_validate_geopoint_required_constraint_issue_231(log):
report = validate('data/datapackages/geopoint/datapackage.json')
assert report['valid']

0 comments on commit cb3fe71

Please sign in to comment.