Skip to content

Commit

Permalink
Skip test for | in dictionaries due to PEP-584 in Python 3.9+ (#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
tirkarthi authored Sep 14, 2020
1 parent 8b19be2 commit d184697
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/unittest_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -2455,7 +2455,6 @@ def test_binary_op_type_errors(self):
1 ** (lambda x: x) #@
{} * {} #@
{} - {} #@
{} | {} #@
{} >> {} #@
[] + () #@
() + [] #@
Expand Down Expand Up @@ -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"),
Expand All @@ -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)
Expand Down

0 comments on commit d184697

Please sign in to comment.