Skip to content

Commit

Permalink
test: validation error raised if 'output_root' provided
Browse files Browse the repository at this point in the history
  • Loading branch information
aaraney committed Aug 13, 2024
1 parent 8c308b2 commit ed25351
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/ngen_cal/tests/test_ngen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@ def test_NgenIndependent_strategy_default_value():
o = NgenIndependent.construct()
assert o.strategy == NgenStrategy.independent


def test_NgenUniform_strategy_default_value():
# construct object without validation.
o = NgenUniform.construct()
assert o.strategy == NgenStrategy.uniform


def test_NgenBase_verify_realization(ngen_config: Ngen):
# session level pytest fixture. take deep copy to avoid pollution
config = ngen_config.__root__.copy(deep=True)
assert isinstance(config, NgenBase)

assert config.ngen_realization is not None, "should have already raised if not None"
config.ngen_realization.output_root = pathlib.Path("./output_root")

with pytest.raises(pydantic.ValidationError):
Ngen.parse_obj(dict(config))

0 comments on commit ed25351

Please sign in to comment.