Skip to content

Commit

Permalink
Fix #13 - Regex checks fail in 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Feb 8, 2017
1 parent 2ab2622 commit adf0026
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion msrest/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class Serializer(object):
"maximum_ex": lambda x, y: x >= y,
"min_items": lambda x, y: len(x) < y,
"max_items": lambda x, y: len(x) > y,
"pattern": lambda x, y: not re.match(y, x),
"pattern": lambda x, y: not re.match(y, x, re.UNICODE),
"unique": lambda x, y: len(x) != len(set(x)),
"multiple": lambda x, y: x % y != 0
}
Expand Down
5 changes: 5 additions & 0 deletions test/unittest_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ def setUp(self):
self.s = Serializer()
return super(TestRuntimeSerialized, self).setUp()

def test_validate(self):
# Assert not necessary, should not raise exception
self.s.validate("simplestring", "StringForLog", pattern="^[a-z]+$")
self.s.validate(u"UTF8ééééé", "StringForLog", pattern=r"^[\w]+$")

def test_obj_serialize_none(self):
"""Test that serialize None in object is still None.
"""
Expand Down

0 comments on commit adf0026

Please sign in to comment.