@@ -20,11 +20,13 @@ def test_mem_regex(self):
2020 def test_normalize_key (self ):
2121 _ = constraints .normalize_key
2222
23- self .assertEqual (_ ("test-key" ), "test_key" )
24- self .assertEqual (_ ("test-key " ), "test_key" )
25- self .assertEqual (_ (" test-key" ), "test_key" )
26- self .assertEqual (_ ("TestKey" ), "test_key" )
27- self .assertEqual (_ ("testKey" ), "test_key" )
23+ self .assertEqual (_ ("root-disk" ), "root_disk" )
24+ self .assertEqual (_ ("root-disk " ), "root_disk" )
25+ self .assertEqual (_ (" root-disk" ), "root_disk" )
26+ self .assertEqual (_ ("RootDisk" ), "root_disk" )
27+ self .assertEqual (_ ("rootDisk" ), "root_disk" )
28+
29+ self .assertRaises (Exception , lambda : _ ("not-one-of-the-supported-keys" ))
2830
2931 def test_normalize_val (self ):
3032 _ = constraints .normalize_value
@@ -53,13 +55,16 @@ def test_parse_constraints(self):
5355 )
5456
5557 self .assertEqual (
56- _ ("mem=10G foo =bar,baz tags=tag1 spaces=space1,space2" ),
58+ _ ("mem=10G zones =bar,baz tags=tag1 spaces=space1,space2" ),
5759 {"mem" : 10 * 1024 ,
58- "foo " : "bar,baz" ,
60+ "zones " : "bar,baz" ,
5961 "tags" : ["tag1" ],
6062 "spaces" : ["space1" , "space2" ]}
6163 )
6264
65+ self .assertRaises (Exception , lambda : _ ("root-disk>16G" ))
66+ self .assertRaises (Exception , lambda : _ ("root-disk>=16G" ))
67+
6368 def test_parse_storage_constraint (self ):
6469 _ = constraints .parse_storage_constraint
6570
0 commit comments