aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_source_encoding.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_source_encoding.py')
-rw-r--r--Lib/test/test_source_encoding.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_source_encoding.py b/Lib/test/test_source_encoding.py
index cfc4b13f18f..b05173ad00d 100644
--- a/Lib/test/test_source_encoding.py
+++ b/Lib/test/test_source_encoding.py
@@ -160,6 +160,18 @@ class MiscSourceEncodingTest(unittest.TestCase):
finally:
os.unlink(TESTFN)
+ def test_tokenizer_fstring_warning_in_first_line(self):
+ source = "0b1and 2"
+ with open(TESTFN, "w") as fd:
+ fd.write("{}".format(source))
+ try:
+ retcode, stdout, stderr = script_helper.assert_python_ok(TESTFN)
+ self.assertIn(b"SyntaxWarning: invalid binary litera", stderr)
+ self.assertEqual(stderr.count(source.encode()), 1)
+ finally:
+ os.unlink(TESTFN)
+
+
class AbstractSourceEncodingTest:
def test_default_coding(self):