Skip to content

Commit

Permalink
Add Enum support for matching
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryR authored and HarryR committed Feb 8, 2019
1 parent 39c14ff commit 0fb231c
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 0fb231c

Please sign in to comment.