Skip to content

Commit

Permalink
Merge pull request santinic#21 from HarryR/master
Browse files Browse the repository at this point in the history
Add Enum support for matching
  • Loading branch information
santinic authored Feb 18, 2019
2 parents 39c14ff + 0fb231c commit fb39ffd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pampy/pampy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import Iterable
from itertools import zip_longest
from enum import Enum
from typing import Tuple, List
from typing import Pattern as RegexPattern

Expand Down Expand Up @@ -28,7 +29,7 @@ def run(action, var):
def match_value(pattern, value) -> Tuple[bool, List]:
if value is PaddedValue:
return False, []
elif isinstance(pattern, (int, float, str, bool)):
elif isinstance(pattern, (int, float, str, bool, Enum)):
eq = pattern == value
type_eq = type(pattern) == type(value)
return eq and type_eq, []
Expand Down

0 comments on commit fb39ffd

Please sign in to comment.