@@ -10,3 +10,61 @@ def test_suppress_errors():
1010
1111 with pytest .raises (RuntimeError , match = "suppress_errors must be boolean" ):
1212 run .config (suppress_errors = 200 )
13+
14+ def test_run_init_metadata ():
15+ """
16+ Check that run.init throws an exception if tuples are passed into metadata dictionary
17+ """
18+ os .environ ["SIMVUE_TOKEN" ] = "test"
19+ os .environ ["SIMVUE_URL" ] = "https://simvue.io"
20+
21+ x1_lower = 2 ,
22+ x1_upper = 6 ,
23+
24+ run = Run (mode = 'offline' )
25+
26+ with pytest .raises (RuntimeError ) as exc_info :
27+ run .init (metadata = {'dataset.x1_lower' : x1_lower , 'dataset.x1_upper' : x1_upper },
28+ description = "A test to validate inputs passed into metadata dictionary"
29+ )
30+
31+ assert exc_info .match (r"value is not a valid integer" )
32+
33+ def test_run_init_tags ():
34+ """
35+ Check that run.init throws an exception if tags are not a list
36+ """
37+ os .environ ["SIMVUE_TOKEN" ] = "test"
38+ os .environ ["SIMVUE_URL" ] = "https://simvue.io"
39+
40+ x1_lower = 2
41+ x1_upper = 6
42+
43+ run = Run (mode = 'offline' )
44+
45+ with pytest .raises (RuntimeError ) as exc_info :
46+ run .init (metadata = {'dataset.x1_lower' : x1_lower , 'dataset.x1_upper' : x1_upper }, tags = 1 ,
47+ description = "A test to validate tag inputs passed into run.init"
48+ )
49+
50+ assert exc_info .match (r"value is not a valid list" )
51+
52+ def test_run_init_folder ():
53+ """
54+ Check that run.init throws an exception if folder input is not specified correctly
55+ """
56+ os .environ ["SIMVUE_TOKEN" ] = "test"
57+ os .environ ["SIMVUE_URL" ] = "https://simvue.io"
58+
59+ x1_lower = 2
60+ x1_upper = 6
61+
62+ run = Run (mode = 'offline' )
63+
64+ with pytest .raises (RuntimeError ) as exc_info :
65+ run .init (metadata = {'dataset.x1_lower' : x1_lower , 'dataset.x1_upper' : x1_upper }, tags = [1 ,2 ,3 ], folder = 'test_folder' ,
66+ description = "A test to validate folder input passed into run.init"
67+ )
68+
69+ assert exc_info .match (r"string does not match regex" )
70+
0 commit comments