Commit 56ec4f1f authored by Kyle Stanley's avatar Kyle Stanley Committed by Miss Islington (bot)

bpo-19696: Replace deprecated method in "test_import_pkg.py" (GH-14466)



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
parent 53c21434
...@@ -14,7 +14,7 @@ class TestImport(unittest.TestCase): ...@@ -14,7 +14,7 @@ class TestImport(unittest.TestCase):
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
self.package_name = 'PACKAGE_' self.package_name = 'PACKAGE_'
while self.package_name in sys.modules: 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' self.module_name = self.package_name + '.foo'
unittest.TestCase.__init__(self, *args, **kw) unittest.TestCase.__init__(self, *args, **kw)
...@@ -60,7 +60,7 @@ class TestImport(unittest.TestCase): ...@@ -60,7 +60,7 @@ class TestImport(unittest.TestCase):
# ...make up a variable name that isn't bound in __builtins__ # ...make up a variable name that isn't bound in __builtins__
var = 'a' var = 'a'
while var in dir(__builtins__): while var in dir(__builtins__):
var += random.choose(string.ascii_letters) var += random.choice(string.ascii_letters)
# ...make a module that just contains that # ...make a module that just contains that
self.rewrite_file(var) self.rewrite_file(var)
......
...@@ -1572,6 +1572,7 @@ Tage Stabell-Kulo ...@@ -1572,6 +1572,7 @@ Tage Stabell-Kulo
Quentin Stafford-Fraser Quentin Stafford-Fraser
Frank Stajano Frank Stajano
Joel Stanley Joel Stanley
Kyle Stanley
Anthony Starks Anthony Starks
David Steele David Steele
Oliver Steele Oliver Steele
......
Replace deprecated method "random.choose" with "random.choice" in "test_pkg_import.py".
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment