File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1- from typing import Literal
1+ from typing import Literal , Optional
22from pydantic import validator
33
44from mavedb .view_models import record_type_validator , set_record_type
77
88class OddsPathBase (BaseModel ):
99 ratio : float
10- evidence : Literal ["BS3_STRONG" , "PS3_STRONG" ]
10+ evidence : Optional [
11+ Literal [
12+ "BS3_STRONG" ,
13+ "BS3_MODERATE" ,
14+ "BS3_SUPPORTING" ,
15+ "INDETERMINATE" ,
16+ "PS3_VERY_STRONG" ,
17+ "PS3_STRONG" ,
18+ "PS3_MODERATE" ,
19+ "PS3_SUPPORTING" ,
20+ ]
21+ ] = None
1122
1223
1324class OddsPathModify (OddsPathBase ):
Original file line number Diff line number Diff line change @@ -13,6 +13,15 @@ def test_odds_path_base_valid_data(valid_data):
1313 assert odds_path .evidence == valid_data ["evidence" ]
1414
1515
16+ def test_odds_path_base_no_evidence ():
17+ odds_with_no_evidence = TEST_BS3_ODDS_PATH .copy ()
18+ odds_with_no_evidence ["evidence" ] = None
19+
20+ odds_path = OddsPathBase (** odds_with_no_evidence )
21+ assert odds_path .ratio == odds_with_no_evidence ["ratio" ]
22+ assert odds_path .evidence is None
23+
24+
1625@pytest .mark .parametrize ("valid_data" , [TEST_BS3_ODDS_PATH , TEST_PS3_ODDS_PATH ])
1726def test_odds_path_base_invalid_data (valid_data ):
1827 odds_path = OddsPathModify (** valid_data )
You can’t perform that action at this time.
0 commit comments