summaryrefslogtreecommitdiff
blob: 0f838b7214a4a754c0104a6fcf551bc16c29f10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 3ffe25f8e3cdb30f0dcfb68f4373370828894727 Mon Sep 17 00:00:00 2001
From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Date: Tue, 4 Aug 2020 10:11:44 +0000
Subject: [PATCH] Skip test for | in dictionaries due to PEP-584 in Python 3.9+

---
 tests/unittest_inference.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py
index 76c7e879..b7bc732d 100644
--- a/tests/unittest_inference.py
+++ b/tests/unittest_inference.py
@@ -2455,7 +2455,6 @@ def test_binary_op_type_errors(self):
         1 ** (lambda x: x) #@
         {} * {} #@
         {} - {} #@
-        {} | {} #@
         {} >> {} #@
         [] + () #@
         () + [] #@
@@ -2500,7 +2499,6 @@ def __radd__(self, other):
             msg.format(op="**", lhs="int", rhs="function"),
             msg.format(op="*", lhs="dict", rhs="dict"),
             msg.format(op="-", lhs="dict", rhs="dict"),
-            msg.format(op="|", lhs="dict", rhs="dict"),
             msg.format(op=">>", lhs="dict", rhs="dict"),
             msg.format(op="+", lhs="list", rhs="tuple"),
             msg.format(op="+", lhs="tuple", rhs="list"),
@@ -2515,6 +2513,12 @@ def __radd__(self, other):
             msg.format(op="+=", lhs="int", rhs="A"),
             msg.format(op="+=", lhs="int", rhs="list"),
         ]
+
+        # PEP-584 supports | for dictionary union
+        if sys.version_info < (3, 9):
+            ast_nodes.append(extract_node("{} | {} #@"))
+            expected.append(msg.format(op="|", lhs="dict", rhs="dict"))
+
         for node, expected_value in zip(ast_nodes, expected):
             errors = node.type_errors()
             self.assertEqual(len(errors), 1)