File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/models-library/tests Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,24 @@ def test_short_truncated_string():
8181 assert (
8282 TypeAdapter (ShortTruncatedStr ).validate_python ("X" * curtail_length )
8383 == "X" * curtail_length
84- )
84+ ), "Max length string should remain intact"
8585
8686 assert (
8787 TypeAdapter (ShortTruncatedStr ).validate_python ("X" * (curtail_length + 1 ))
8888 == "X" * curtail_length
89- )
89+ ), "Overlong string should be truncated exactly to max length"
90+
91+ assert (
92+ TypeAdapter (ShortTruncatedStr ).validate_python ("X" * (curtail_length + 100 ))
93+ == "X" * curtail_length
94+ ), "Much longer string should still truncate to exact max length"
95+
96+ # below limit
97+ assert TypeAdapter (ShortTruncatedStr ).validate_python (
98+ "X" * (curtail_length - 1 )
99+ ) == "X" * (curtail_length - 1 ), "Under-length string should not be modified"
100+
101+ # spaces are trimmed
102+ assert (
103+ TypeAdapter (ShortTruncatedStr ).validate_python (" " * (curtail_length + 1 )) == ""
104+ ), "Only-whitespace string should become empty string"
You can’t perform that action at this time.
0 commit comments