bpo-37289: Add a test for if with ifexpr in the peephole optimiser to detect regressions (GH-14127)

This commit is contained in:
Pablo Galindo 2019-06-20 22:17:03 +01:00 committed by GitHub
parent c68e3fb15d
commit 1e61504b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -421,6 +421,14 @@ class TestTranforms(BytecodeTestCase):
return 0
self.assertEqual(f(), 1)
def test_if_with_if_expression(self):
# Check bpo-37289
def f(x):
if (True if x else False):
return True
return False
self.assertTrue(f(True))
class TestBuglets(unittest.TestCase):