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 = {
3414
3414
.tp_iter = (getiterfunc )map_tp_iter ,
3415
3415
.tp_dealloc = (destructor )map_tp_dealloc ,
3416
3416
.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
+ ,
3418
3422
.tp_richcompare = map_tp_richcompare ,
3419
3423
.tp_traverse = (traverseproc )map_tp_traverse ,
3420
3424
.tp_clear = (inquiry )map_tp_clear ,
Original file line number Diff line number Diff line change
1
+ import sys
1
2
# We need the mypy pytest plugin to do the test collection for our
2
3
# typing tests.
3
4
11
12
pytest_plugins = [
12
13
'mypy.test.data' ,
13
14
]
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