Skip to content

Commit

Permalink
test: check constraint AASd-130 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jkhsjdhjs committed Oct 5, 2023
1 parent 3e2fc1e commit 2d32efb
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/model/test_string_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ def test_version_type(self) -> None:
version = "0"
_string_constraints.check_version_type(version)

def test_aasd_130(self) -> None:
name: model.NameType = "\0"
with self.assertRaises(ValueError) as cm:
_string_constraints.check_name_type(name)
self.assertEqual(r"Every string must match the pattern '[\t\n\r -\ud7ff\ue000-\ufffd\U00010000-\U0010ffff]*'! "
r"(value: '\x00')", cm.exception.args[0])
name = "\ud800"
with self.assertRaises(ValueError) as cm:
_string_constraints.check_name_type(name)
self.assertEqual(r"Every string must match the pattern '[\t\n\r -\ud7ff\ue000-\ufffd\U00010000-\U0010ffff]*'! "
r"(value: '\ud800')", cm.exception.args[0])
name = "\ufffe"
with self.assertRaises(ValueError) as cm:
_string_constraints.check_name_type(name)
self.assertEqual(r"Every string must match the pattern '[\t\n\r -\ud7ff\ue000-\ufffd\U00010000-\U0010ffff]*'! "
r"(value: '\ufffe')", cm.exception.args[0])
name = "this\ris\na\tvalid täst\uffdd\U0010ab12"
_string_constraints.check_name_type(name)


class StringConstraintsDecoratorTest(unittest.TestCase):
@_string_constraints.constrain_path_type("some_attr")
Expand Down

0 comments on commit 2d32efb

Please sign in to comment.