if isinstance(expected, no_match):
return not _match_decorator_property(expected.item, actual)
- if isinstance(expected, (re.Pattern, str)):
+ # Python 3.6 doesn't declare a `re.Pattern` type, get the dynamic type.
+ pattern_type = type(re.compile(''))
+ if isinstance(expected, (pattern_type, str)):
return re.search(expected, actual) is not None
if hasattr(expected, "__iter__"):
test_base.assertSuccess(val.GetError())
+ # Python 3.6 doesn't declare a `re.Pattern` type, get the dynamic type.
+ pattern_type = type(re.compile(''))
+
if self.expect_name:
test_base.assertEqual(self.expect_name, val.GetName(),
this_error_msg)
if self.expect_value:
- if isinstance(self.expect_value, re.Pattern):
+ if isinstance(self.expect_value, pattern_type):
test_base.assertRegex(val.GetValue(), self.expect_value,
this_error_msg)
else:
test_base.assertEqual(self.expect_type, val.GetDisplayTypeName(),
this_error_msg)
if self.expect_summary:
- if isinstance(self.expect_summary, re.Pattern):
+ if isinstance(self.expect_summary, pattern_type):
test_base.assertRegex(val.GetSummary(), self.expect_summary,
this_error_msg)
else: