From 3ffe25f8e3cdb30f0dcfb68f4373370828894727 Mon Sep 17 00:00:00 2001 From: Karthikeyan Singaravelan 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)