1616# License along with this library. If not, see <https://www.gnu.org/licenses/>.
1717
1818from enum import Enum
19- from typing import Any , Dict , List , Type
19+ from typing import Any , Dict , List , Optional , Type
2020
21- from fluster .codec import OutputFormat
21+ from fluster .codec import OutputFormat , Profile
2222
2323
2424class TestVectorResult (Enum ):
@@ -43,12 +43,14 @@ def __init__(
4343 input_file : str ,
4444 output_format : OutputFormat ,
4545 result : str ,
46+ profile : Optional [Profile ] = None ,
4647 ):
4748 # JSON members
4849 self .name = name
4950 self .source = source
5051 self .source_checksum = source_checksum
5152 self .input_file = input_file
53+ self .profile = profile
5254 self .output_format = output_format
5355 self .result = result
5456
@@ -64,6 +66,11 @@ def from_json(cls: Type["TestVector"], data: Any) -> Any:
6466 data ["output_format" ] = OutputFormat (data ["output_format" ])
6567 else :
6668 data ["output_format" ] = OutputFormat .NONE
69+
70+ # We only define profile if the paramter is found in .json of test suite
71+ if "profile" in data :
72+ data ["profile" ] = Profile (data ["profile" ])
73+
6774 return (data ["name" ], cls (** data ))
6875
6976 def data_to_serialize (self ) -> Dict [str , object ]:
@@ -73,13 +80,18 @@ def data_to_serialize(self) -> Dict[str, object]:
7380 data .pop ("errors" )
7481 data .pop ("test_time" )
7582 data ["output_format" ] = str (self .output_format .value )
83+ if self .profile is not None :
84+ data ["profile" ] = str (self .profile .value )
85+ else :
86+ data .pop ("profile" )
7687 return data
7788
7889 def __str__ (self ) -> str :
7990 ret = (
8091 f" { self .name } \n "
8192 f" Source: { self .source } \n "
8293 f" Input: { self .input_file } \n "
94+ f" Profile: { self .profile } \n "
8395 f" Result: { self .result } "
8496 )
8597 return ret
0 commit comments