@@ -22,9 +22,28 @@ def test_terminate_regex_end_of_line_like_a_normal_person():
2222 assert re .match (modified_regex , "dfqh3eqefhq" )
2323
2424
25- def test_terminate_regex_no_termination_needed ():
25+ def test_terminate_regex_line_start_change ():
2626 original_regex = r"^[a-zA-Z0-9]{1,219}\Z"
27- assert terminate_regex (original_regex ) == original_regex
27+ terminated_regex = r"\A[a-zA-Z0-9]{1,219}\Z"
28+ assert terminate_regex (original_regex ) == terminated_regex
29+
30+
31+ def test_terminate_regex_line_end_change ():
32+ original_regex = r"\A[a-zA-Z0-9]{1,219}$"
33+ terminated_regex = r"\A[a-zA-Z0-9]{1,219}\Z"
34+ assert terminate_regex (original_regex ) == terminated_regex
35+
36+
37+ def test_terminate_regex_line_start_and_end_change ():
38+ original_regex = r"^[a-zA-Z0-9]{1,219}$"
39+ terminated_regex = r"\A[a-zA-Z0-9]{1,219}\Z"
40+ assert terminate_regex (original_regex ) == terminated_regex
41+
42+
43+ def test_terminate_regex_no_termination_needed ():
44+ original_regex = r"\A[a-zA-Z0-9]{1,219}\Z"
45+ terminated_regex = r"\A[a-zA-Z0-9]{1,219}\Z"
46+ assert terminate_regex (original_regex ) == terminated_regex
2847
2948
3049@pytest .mark .parametrize ("schema_type" , ["integer" , "number" ])
@@ -80,6 +99,22 @@ def test_generate_string_strategy_format():
8099 strategy = ResourceGenerator (schema ).generate_schema_strategy (schema )
81100 assert re .fullmatch (STRING_FORMATS ["arn" ], strategy .example ())
82101
102+ schema = {"type" : "string" , "format" : "date-time" }
103+ strategy = ResourceGenerator (schema ).generate_schema_strategy (schema )
104+ assert re .match (STRING_FORMATS ["date-time" ], strategy .example ())
105+
106+ schema = {"type" : "string" , "format" : "time" }
107+ strategy = ResourceGenerator (schema ).generate_schema_strategy (schema )
108+ assert re .match (STRING_FORMATS ["time" ], strategy .example ())
109+
110+ schema = {"type" : "string" , "format" : "date" }
111+ strategy = ResourceGenerator (schema ).generate_schema_strategy (schema )
112+ assert re .match (STRING_FORMATS ["date" ], strategy .example ())
113+
114+ schema = {"type" : "string" , "format" : "email" }
115+ strategy = ResourceGenerator (schema ).generate_schema_strategy (schema )
116+ assert re .match (STRING_FORMATS ["email" ], strategy .example ())
117+
83118
84119def test_generate_string_strategy_length ():
85120 schema = {"type" : "string" , "minLength" : 5 , "maxLength" : 10 }
0 commit comments