Skip to content

Commit

Permalink
test enums
Browse files Browse the repository at this point in the history
  • Loading branch information
santinic committed Feb 18, 2019
1 parent fb39ffd commit 83d3565
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest

from enum import Enum
import re

from pampy import match_value, match, HEAD, TAIL, _, MatchError
Expand Down Expand Up @@ -143,3 +143,13 @@ def what_is(pet):

self.assertEqual(what_is('my-fuffy-cat'), 'fuffy-cat')

def test_match_enum(self):
class Color(Enum):
RED = 1
GREEN = 2
BLUE = 3

self.assertEqual(match(Color.RED, Color.BLUE, "blue", Color.RED, "red", _, "else"), "red")
self.assertEqual(match(Color.RED, Color.BLUE, "blue", Color.GREEN, "green", _, "else"), "else")
self.assertEqual(match(1, Color.BLUE, "blue", Color.GREEN, "green", _, "else"), "else")

0 comments on commit 83d3565

Please sign in to comment.