Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76d8c9f

Browse files
committed
fixup! Update Misc/NEWS.d/next/Core_and_Builtins/2024-10-29-23-30-35.gh-issue-125331.quKQ7V.rst
1 parent babe18b commit 76d8c9f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Lib/test/test_flufl.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ def test_barry_as_bdfl_look_ma_with_no_compiler_flags(self):
4747
self.assertEqual(cm.exception.lineno, 1)
4848
self.assertEqual(cm.exception.offset, len(code) - 4)
4949

50+
def test_barry_as_bdfl_relative_import(self):
51+
code = "from .__future__ import barry_as_FLUFL;2 {0} 3"
52+
compile(code.format('!='), '<FLUFL test>', 'exec')
53+
with self.assertRaises(SyntaxError) as cm:
54+
compile(code.format('<>'), '<BDFL test>', 'exec')
55+
self.assertRegex(str(cm.exception), "<BDFL test>")
56+
self.assertIn('2 <> 3', cm.exception.text)
57+
self.assertEqual(cm.exception.filename, '<BDFL test>')
58+
self.assertEqual(cm.exception.lineno, 1)
59+
self.assertEqual(cm.exception.offset, len(code) - 4)
60+
61+
62+
5063

5164
if __name__ == '__main__':
5265
unittest.main()

0 commit comments

Comments
 (0)