summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Singaravelan <tir.karthi@gmail.com>2020-09-15 01:43:47 +0530
committerGitHub <noreply@github.com>2020-09-14 22:13:47 +0200
commitd1846979910842901ba96e367e8dac3f12aefc6b (patch)
treee3f21d01ad29bd286aca54330852df8a862539a4
parent8b19be2157bea55b67f5383162dd9d48072a48e3 (diff)
downloadastroid-git-d1846979910842901ba96e367e8dac3f12aefc6b.tar.gz
Skip test for | in dictionaries due to PEP-584 in Python 3.9+ (#829)
-rw-r--r--tests/unittest_inference.py8
1 files 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 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
1 ** (lambda x: x) #@
{} * {} #@
{} - {} #@
- {} | {} #@
{} >> {} #@
[] + () #@
() + [] #@
@@ -2500,7 +2499,6 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
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 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
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)