Skip to content

Commit

Permalink
test: add fixtures for onthology and scenes
Browse files Browse the repository at this point in the history
  • Loading branch information
tklockau committed Oct 20, 2023
1 parent c625e4f commit 0078322
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
9 changes: 9 additions & 0 deletions tests/test_raillabel_providerkit/validation/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright DB Netz AG and contributors
# SPDX-License-Identifier: Apache-2.0

from validate_onthology.test_validate_onthology import (
demo_onthology,
invalid_onthology_scene,
metadata,
valid_onthology_scene,
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def build_scene(
}
)

@pytest.fixture
def metadata():
return raillabel.format.Metadata(schema_version="1.0.0")

@pytest.fixture
def sensors() -> t.List[raillabel.format.Sensor]:
return {
Expand Down Expand Up @@ -93,6 +89,39 @@ def build_annotation(
size=[],
)

# == Fixtures =========================

@pytest.fixture
def metadata():
return raillabel.format.Metadata(schema_version="1.0.0")

@pytest.fixture
def demo_onthology() -> dict:
return {
"person": {},
"train": {},
}

@pytest.fixture
def valid_onthology_scene(metadata) -> raillabel.Scene:
return raillabel.format.Scene(
metadata=metadata,
objects=make_dict_with_uids([
build_object("person"),
build_object("person"),
build_object("train"),
])
)

@pytest.fixture
def invalid_onthology_scene(metadata) -> raillabel.Scene:
return raillabel.format.Scene(
metadata=metadata,
objects=make_dict_with_uids([
build_object("INVALID_CLASS"),
])
)

# == Tests ============================

def test_onthology_schema_invalid():
Expand Down

0 comments on commit 0078322

Please sign in to comment.