Skip to content

Commit

Permalink
Update "classic" to "neo-classic" schema.json in test/resources/classic
Browse files Browse the repository at this point in the history
  • Loading branch information
JGoldstone committed Feb 11, 2025
1 parent 6d04b05 commit 5c20daf
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions src/test/python/test_schema_regression.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
import sys
from pathlib import Path
import unittest
import json
from jsonschema import validate
from pathlib import Path

from .test_example_regression import CLASSIC, CURRENT
from src.test.python.test_example_regression import CLASSIC, CURRENT

CLASSIC_SCHEMA_DIR: Path = CLASSIC / "build" / "opentrackio"
CLASSIC_SCHEMA_DIR: Path = CLASSIC
CLASSIC_SCHEMA = CLASSIC_SCHEMA_DIR / "schema.json"

PYDANTIC_SCHEMA_DIR: Path = CURRENT / "build" / "opentrackio"
PYDANTIC_SCHEMA = PYDANTIC_SCHEMA_DIR / "schema.json"
CURRENT_SCHEMA_DIR: Path = CURRENT
CURRENT_SCHEMA = CURRENT_SCHEMA_DIR / "schema.json"


class schemaTestCases(unittest.TestCase):

def test_current_schema_against_classic_schema(self):
with open(CLASSIC_SCHEMA) as classic_schema_file:
classic_schema = json.load(classic_schema_file)
with open(CURRENT_SCHEMA) as current_schema_file:
current_schema = json.load(current_schema_file)
with open("/tmp/sorted_classic_schema_file.json", "w") as sclsf:
json.dump(classic_schema, sclsf, indent=4, sort_keys=True)
with open("/tmp/sorted_current_schema_file.json", "w") as scusf:
json.dump(current_schema, scusf, indent=4, sort_keys=True)
self.assertEqual(classic_schema, current_schema)


def test_pydantic_schema_against_classic_schema(self):
with open(CLASSIC_SCHEMA) as classic_schema_file:
classic_schema = json.load(classic_schema_file)
with open(PYDANTIC_SCHEMA) as pydantic_schema_file:
pydantic_schema = json.load(pydantic_schema_file)
self.assertEqual(classic_schema, pydantic_schema)
if __name__ == '__main__':
unittest.main()

0 comments on commit 5c20daf

Please sign in to comment.