Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
calmacx committed Feb 5, 2024
1 parent b5eb247 commit 0ac1cc8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion hdr_schemata/models/GWDM/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@
"$ref": "#/$defs/TimeLag"
}
],
"description": "Rypical time-lag between an event and the data for that event appearing in the dataset",
"description": "Typical time-lag between an event and the data for that event appearing in the dataset",
"example": "LESS 1 WEEK",
"title": "Time Lag"
},
Expand Down
2 changes: 1 addition & 1 deletion hdr_schemata/models/GWDM/1.1/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@
"$ref": "#/$defs/TimeLag"
}
],
"description": "Rypical time-lag between an event and the data for that event appearing in the dataset",
"description": "Typical time-lag between an event and the data for that event appearing in the dataset",
"example": "LESS 1 WEEK",
"title": "Time Lag"
},
Expand Down
59 changes: 40 additions & 19 deletions hdr_schemata/tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,82 @@
from hdr_schemata.models.SchemaOrg import BioSchema


def get_metadata(model,version):
metadata = json.load(open(f'../examples/{model}/{version}/example.json'))
def get_metadata(model, version):
metadata = json.load(open(f"../examples/{model}/{version}/example.json"))
return metadata

def get_schema(model,version):
metadata = json.load(open(f'../models/{model}/{version}/schema.json'))

def get_schema(model, version):
metadata = json.load(open(f"../models/{model}/{version}/schema.json"))
return metadata


class TestHdruk212:
metadata = get_metadata('HDRUK','2.1.2')
json_schema = get_schema('HDRUK','2.1.2')
metadata = get_metadata("HDRUK", "2.1.2")
json_schema = get_schema("HDRUK", "2.1.2")

def test_validation(self):
assert Hdruk212(**self.metadata) != None

def test_json_schema(self):
schema = Hdruk212.model_json_schema()
expected_keys = ['$defs', 'additionalProperties', 'properties', 'required', 'title', 'type']
expected_keys = [
"$defs",
"additionalProperties",
"properties",
"required",
"title",
"type",
]
assert list(schema.keys()) == expected_keys
assert schema == self.json_schema


class TestGwdm10:
metadata = get_metadata('GWDM','1.0')
json_schema = get_schema('GWDM','1.0')
metadata = get_metadata("GWDM", "1.0")
json_schema = get_schema("GWDM", "1.0")

def test_validation(self):
assert Gwdm10(**self.metadata) != None

def test_json_schema(self):
schema = Gwdm10.model_json_schema()
expected_keys = ['$defs', 'additionalProperties', 'properties', 'required', 'title', 'type']
expected_keys = [
"$defs",
"additionalProperties",
"properties",
"required",
"title",
"type",
]
print(expected_keys)
print(list(schema.keys()))

assert list(schema.keys()) == expected_keys
assert schema == self.json_schema


class TestGoogleRecommended:
metadata = get_metadata('SchemaOrg','GoogleRecommended')
json_schema = get_schema('SchemaOrg','GoogleRecommended')
metadata = get_metadata("SchemaOrg", "GoogleRecommended")
json_schema = get_schema("SchemaOrg", "GoogleRecommended")

def test_organization(self):
from hdr_schemata.models.SchemaOrg.GoogleRecommended import Organization
assert Organization(**self.metadata['creator']) != None


assert Organization(**self.metadata["creator"]) != None

def test_validation(self):
assert GoogleRecommendedDataset(**self.metadata) != None

def test_json_schema(self):
schema = GoogleRecommendedDataset.model_json_schema()
assert schema == self.json_schema


class TestBioSchema:
metadata = get_metadata('SchemaOrg','BioSchema')
json_schema = get_schema('SchemaOrg','BioSchema')
metadata = get_metadata("SchemaOrg", "BioSchema")
json_schema = get_schema("SchemaOrg", "BioSchema")

def test_validation(self):
assert BioSchema(**self.metadata) != None

Expand Down

0 comments on commit 0ac1cc8

Please sign in to comment.