bpo-37289: Add a test for if with ifexpr in the peephole optimiser to detect regressions (GH-14127)
This commit is contained in:
parent
c68e3fb15d
commit
1e61504b8b
|
@ -421,6 +421,14 @@ class TestTranforms(BytecodeTestCase):
|
||||||
return 0
|
return 0
|
||||||
self.assertEqual(f(), 1)
|
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):
|
class TestBuglets(unittest.TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue