]> granicus.if.org Git - python/commitdiff
bpo-19696: Replace deprecated method in "test_import_pkg.py" (GH-14466)
authorKyle Stanley <aeros167@gmail.com>
Wed, 3 Jul 2019 18:22:40 +0000 (14:22 -0400)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 3 Jul 2019 18:22:40 +0000 (11:22 -0700)
Replacing the deprecated method "random.choose" to "random.choice" was technically not part of the original issue. However, it was discussed in the talk page and involved one of the files being moved. I assumed this was too minor to justify the creation of a separate issue.

Also, I added my name to the contributors list in Misc/ACKS. This will be my third PR to cpython, forgot to do it in the previous ones.

https://bugs.python.org/issue19696

Lib/test/test_importlib/test_pkg_import.py
Misc/ACKS
Misc/NEWS.d/next/Tests/2019-06-29-16-02-21.bpo-19696.05ijhN.rst [new file with mode: 0644]

index 5d9a45111972f6e2bfa3aed491a01082cef0ea37..6181dcfab280cf57dd11fefc652126b2d0388e5f 100644 (file)
@@ -14,7 +14,7 @@ class TestImport(unittest.TestCase):
     def __init__(self, *args, **kw):
         self.package_name = 'PACKAGE_'
         while self.package_name in sys.modules:
-            self.package_name += random.choose(string.ascii_letters)
+            self.package_name += random.choice(string.ascii_letters)
         self.module_name = self.package_name + '.foo'
         unittest.TestCase.__init__(self, *args, **kw)
 
@@ -60,7 +60,7 @@ class TestImport(unittest.TestCase):
         # ...make up a variable name that isn't bound in __builtins__
         var = 'a'
         while var in dir(__builtins__):
-            var += random.choose(string.ascii_letters)
+            var += random.choice(string.ascii_letters)
 
         # ...make a module that just contains that
         self.rewrite_file(var)
index df0810fff46cc62cfe0d2884238552fe47e65923..a4d4372d3443e521402d4f5b6473a13dcca42adb 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1572,6 +1572,7 @@ Tage Stabell-Kulo
 Quentin Stafford-Fraser
 Frank Stajano
 Joel Stanley
+Kyle Stanley
 Anthony Starks
 David Steele
 Oliver Steele
diff --git a/Misc/NEWS.d/next/Tests/2019-06-29-16-02-21.bpo-19696.05ijhN.rst b/Misc/NEWS.d/next/Tests/2019-06-29-16-02-21.bpo-19696.05ijhN.rst
new file mode 100644 (file)
index 0000000..c029fb9
--- /dev/null
@@ -0,0 +1 @@
+Replace deprecated method "random.choose" with "random.choice" in "test_pkg_import.py".
\ No newline at end of file