Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check int vs float and bool vs int inequality
Co-authored-by: Batuhan Taşkaya <batuhanosmantaskaya@gmail.com>
  • Loading branch information
Flavian Hautbois and isidentical committed Mar 27, 2020
commit 4d14244eb6fdb6cc0dbdf4408681568067cddda2
6 changes: 6 additions & 0 deletions Lib/test/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,12 @@ def test_compare_literals(self):
next_constant = constants[next_index]
self.assertNotEqual(ast.Constant(constant), ast.Constant(next_constant))

same_looking_literal_cases = [{1, 1.0, True, 1+0j}, {0, 0.0, False, 0+0j}]
for same_looking_literals for same_looking_literal_cases:
for literal in same_looking_literals:
for same_looking_literal in same_looking_literals - {literal}:
self.assertNotEqual(ast.Constant(literal), ast.Constant(same_looking_literal))

def test_compare_operators(self):
self.assertEqual(ast.Add(), ast.Add())
self.assertEqual(ast.Sub(), ast.Sub())
Expand Down