Skip to content

Commit d184697

Browse files
authored
Skip test for | in dictionaries due to PEP-584 in Python 3.9+ (#829)
1 parent 8b19be2 commit d184697

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/unittest_inference.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,6 @@ def test_binary_op_type_errors(self):
24552455
1 ** (lambda x: x) #@
24562456
{} * {} #@
24572457
{} - {} #@
2458-
{} | {} #@
24592458
{} >> {} #@
24602459
[] + () #@
24612460
() + [] #@
@@ -2500,7 +2499,6 @@ def __radd__(self, other):
25002499
msg.format(op="**", lhs="int", rhs="function"),
25012500
msg.format(op="*", lhs="dict", rhs="dict"),
25022501
msg.format(op="-", lhs="dict", rhs="dict"),
2503-
msg.format(op="|", lhs="dict", rhs="dict"),
25042502
msg.format(op=">>", lhs="dict", rhs="dict"),
25052503
msg.format(op="+", lhs="list", rhs="tuple"),
25062504
msg.format(op="+", lhs="tuple", rhs="list"),
@@ -2515,6 +2513,12 @@ def __radd__(self, other):
25152513
msg.format(op="+=", lhs="int", rhs="A"),
25162514
msg.format(op="+=", lhs="int", rhs="list"),
25172515
]
2516+
2517+
# PEP-584 supports | for dictionary union
2518+
if sys.version_info < (3, 9):
2519+
ast_nodes.append(extract_node("{} | {} #@"))
2520+
expected.append(msg.format(op="|", lhs="dict", rhs="dict"))
2521+
25182522
for node, expected_value in zip(ast_nodes, expected):
25192523
errors = node.type_errors()
25202524
self.assertEqual(len(errors), 1)

0 commit comments

Comments
 (0)