diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-06-20 21:17:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-20 21:17:03 (GMT) |
commit | 1e61504b8b941494f3ac03e0449ddbbba8960175 (patch) | |
tree | 2ecbf822fe410a762f1184686f16d940c5ec2f87 /Lib | |
parent | c68e3fb15d29607a1af2c19ebec552a87c24cb48 (diff) | |
download | cpython-1e61504b8b941494f3ac03e0449ddbbba8960175.zip cpython-1e61504b8b941494f3ac03e0449ddbbba8960175.tar.gz cpython-1e61504b8b941494f3ac03e0449ddbbba8960175.tar.bz2 |
bpo-37289: Add a test for if with ifexpr in the peephole optimiser to detect regressions (GH-14127)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_peepholer.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py index 5d00240..b5f85bd 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -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): |