Add support for multiple types

This commit is contained in:
Bartłomiej Pluta
2019-07-10 01:07:20 +02:00
parent c66d138782
commit fd5c4532cc
2 changed files with 36 additions and 13 deletions

View File

@@ -17,4 +17,10 @@ def ofType(type):
def check(value):
return value.type == type
return Matcher(None, check, type.name.lower())
return Matcher(None, check, type.name.lower())
def oneOf(*matchers):
def check(value):
return any(matcher.match(value) for matcher in matchers)
return Matcher(None, check, f"<{', '.join(m.string for m in matchers)}>")