3131 macros ,
3232 MalformedAppHandleException ,
3333 MISSING ,
34+ MountType ,
3435 NULL_RESOURCE ,
3536 parse_app_handle ,
3637 ReplicaStatus ,
@@ -55,6 +56,20 @@ def test_repr(self) -> None:
5556
5657
5758class AppDefStatusTest (unittest .TestCase ):
59+
60+ def test_app_state_from_str (self ) -> None :
61+ self .assertEqual (AppState .UNSUBMITTED , AppState .from_str ("UNSUBMITTED" ))
62+ self .assertEqual (AppState .SUBMITTED , AppState .from_str ("SUBMITTED" ))
63+ self .assertEqual (AppState .PENDING , AppState .from_str ("PENDING" ))
64+ self .assertEqual (AppState .RUNNING , AppState .from_str ("RUNNING" ))
65+ self .assertEqual (AppState .SUCCEEDED , AppState .from_str ("SUCCEEDED" ))
66+ self .assertEqual (AppState .FAILED , AppState .from_str ("FAILED" ))
67+ self .assertEqual (AppState .CANCELLED , AppState .from_str ("CANCELLED" ))
68+ self .assertEqual (AppState .UNKNOWN , AppState .from_str ("UNKNOWN" ))
69+
70+ with self .assertRaises (ValueError ):
71+ AppState .from_str ("INVALID_STATE" )
72+
5873 def test_is_terminal (self ) -> None :
5974 for s in AppState :
6075 is_terminal = AppStatus (state = s ).is_terminal ()
@@ -315,6 +330,26 @@ def test_retry_policies(self) -> None:
315330 },
316331 )
317332
333+ def test_retry_policy_from_str (self ) -> None :
334+ # Test valid retry policy strings
335+ self .assertEqual (RetryPolicy .APPLICATION , RetryPolicy .from_str ("APPLICATION" ))
336+ self .assertEqual (RetryPolicy .REPLICA , RetryPolicy .from_str ("REPLICA" ))
337+ self .assertEqual (RetryPolicy .ROLE , RetryPolicy .from_str ("ROLE" ))
338+
339+ # Test invalid retry policy string
340+ with self .assertRaises (ValueError ):
341+ RetryPolicy .from_str ("INVALID_POLICY" )
342+
343+ def test_mount_type_from_str (self ) -> None :
344+ # Test valid mount type strings
345+ self .assertEqual (MountType .BIND , MountType .from_str ("BIND" ))
346+ self .assertEqual (MountType .VOLUME , MountType .from_str ("VOLUME" ))
347+ self .assertEqual (MountType .DEVICE , MountType .from_str ("DEVICE" ))
348+
349+ # Test invalid mount type string
350+ with self .assertRaises (ValueError ):
351+ MountType .from_str ("INVALID_MOUNT_TYPE" )
352+
318353 def test_override_role (self ) -> None :
319354 default = Role (
320355 "foobar" ,
0 commit comments