Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
Treesarj committed Mar 13, 2024
1 parent 6f999ab commit 7053162
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions tests/strategies/test_parse_json.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
"""Test parse strategies."""

import json
from pathlib import Path
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from pathlib import Path
import pytest

if TYPE_CHECKING:
from oteapi_dlite.strategies.parse_json import DLiteJsonStrategy
from oteapi.interfaces import IParseStrategy

@pytest.fixture
def static_files() -> Path:
"""Fixture for static files directory."""
return Path(__file__).parent / "static_files"

def test_parse_excel(static_files: "Path") -> None:
"""Test excel parse strategy."""
def test_parse_json(static_files: "Path") -> None:
"""Test json parse strategy."""
import dlite

from oteapi_dlite.strategies.parse_json import DLiteJsonStrategy
from oteapi_dlite.models import DLiteJsonStrategyConfig

sample_file = static_files / "test_parse_json.json"

coll = dlite.Collection()
config = (
config = DLiteJsonStrategyConfig.parse_obj(
{
"entity": "http://onto-ns.com/meta/0.4/HallPetch",
"parserType": "json/vnd.dlite-json",
Expand All @@ -27,9 +33,9 @@ def test_parse_excel(static_files: "Path") -> None:
"mediaType": "application/json",
"resourceType": "resource/url",
},
},
}
)
parser: "IParseStrategy" = DLiteJsonStrategy(config)
parser: "IParseStrategy" = DLiteJsonStrategy(parse_config=config)
parser.initialize()
parser.get()

Expand Down

0 comments on commit 7053162

Please sign in to comment.