[Python-checkins] bpo-43825: Fix deprecation warnings in test_cmd_line and test_collections (GH-25380)

vstinner webhook-mailer at python.org
Wed Apr 14 07:45:26 EDT 2021


https://github.com/python/cpython/commit/b8509ffa82d393d9d4a0f5520edca057978bbd86
commit: b8509ffa82d393d9d4a0f5520edca057978bbd86
branch: master
author: Karthikeyan Singaravelan <tir.karthi at gmail.com>
committer: vstinner <vstinner at python.org>
date: 2021-04-14T13:45:22+02:00
summary:

bpo-43825: Fix deprecation warnings in test_cmd_line and test_collections (GH-25380)

* Fix deprecation warnings due to invalid escape sequences.
* Use self.assertEqual instead of deprecated self.assertEquals.

files:
M Lib/test/test_cmd_line.py
M Lib/test/test_collections.py

diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 375876768b29f..cbf9ff2a863c3 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -862,7 +862,7 @@ def test_tokenizer_error_with_stdin(self):
         self.check_string(b"(1+2+3")
 
     def test_decoding_error_at_the_end_of_the_line(self):
-        self.check_string(b"'\u1f'")
+        self.check_string(br"'\u1f'")
 
 def test_main():
     support.run_unittest(CmdLineTest, IgnoreEnvironmentTest, SyntaxErrorTests)
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 7b245c08b5ddd..98690d231e606 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1515,7 +1515,7 @@ def __repr__(self):
         items = [5,43,2,1]
         s = MySet(items)
         r = s.pop()
-        self.assertEquals(len(s), len(items) - 1)
+        self.assertEqual(len(s), len(items) - 1)
         self.assertNotIn(r, s)
         self.assertIn(r, items)
 



More information about the Python-checkins mailing list