File tree Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Expand file tree Collapse file tree 3 files changed +47
-1
lines changed Original file line number Diff line number Diff line change @@ -3414,7 +3414,11 @@ PyTypeObject _Map_Type = {
34143414 .tp_iter = (getiterfunc )map_tp_iter ,
34153415 .tp_dealloc = (destructor )map_tp_dealloc ,
34163416 .tp_getattro = PyObject_GenericGetAttr ,
3417- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC ,
3417+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC
3418+ #ifdef Py_TPFLAGS_MAPPING
3419+ | Py_TPFLAGS_MAPPING
3420+ #endif
3421+ ,
34183422 .tp_richcompare = map_tp_richcompare ,
34193423 .tp_traverse = (traverseproc )map_tp_traverse ,
34203424 .tp_clear = (inquiry )map_tp_clear ,
Original file line number Diff line number Diff line change 1+ import sys
12# We need the mypy pytest plugin to do the test collection for our
23# typing tests.
34
1112pytest_plugins = [
1213 'mypy.test.data' ,
1314]
15+
16+ if sys .version_info < (3 , 10 ):
17+ collect_ignore = ["test_pattern_matching.py" ]
Original file line number Diff line number Diff line change 1+ import unittest
2+
3+ from immutables .map import Map as PyMap
4+
5+
6+ class BaseMapTest :
7+
8+ Map = None
9+
10+ def test_map_can_be_matched (self ):
11+ match self .Map (a = 1 , b = 2 ): # noqa: E999
12+ case {"a" : 1 as matched }:
13+ matched = matched
14+ case _:
15+ assert False
16+
17+ assert matched == 1
18+
19+
20+ class PyMapTest (BaseMapTest , unittest .TestCase ):
21+
22+ Map = PyMap
23+
24+
25+ try :
26+ from immutables ._map import Map as CMap
27+ except ImportError :
28+ CMap = None
29+
30+
31+ @unittest .skipIf (CMap is None , 'C Map is not available' )
32+ class CMapTest (BaseMapTest , unittest .TestCase ):
33+
34+ Map = CMap
35+
36+
37+ if __name__ == "__main__" :
38+ unittest .main ()
You can’t perform that action at this time.
0 commit comments