Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424: Replace deprecated assert* methods in the Python test suite.
........
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index ad4cf42..12ab3ba 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -88,11 +88,11 @@
# Check we wrote as many items as we thought.
nkeys, nvalues, since_mod = QueryInfoKey(key)
- self.assertEquals(nkeys, 1, "Not the correct number of sub keys")
- self.assertEquals(nvalues, 1, "Not the correct number of values")
+ self.assertEqual(nkeys, 1, "Not the correct number of sub keys")
+ self.assertEqual(nvalues, 1, "Not the correct number of values")
nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
- self.assertEquals(nkeys, 0, "Not the correct number of sub keys")
- self.assertEquals(nvalues, len(test_data),
+ self.assertEqual(nkeys, 0, "Not the correct number of sub keys")
+ self.assertEqual(nvalues, len(test_data),
"Not the correct number of values")
# Close this key this way...
# (but before we do, copy the key as an integer - this allows
@@ -118,8 +118,8 @@
def _read_test_data(self, root_key, OpenKey=OpenKey):
# Check we can get default value for this key.
val = QueryValue(root_key, test_key_name)
- self.assertEquals(val, "Default value",
- "Registry didn't give back the correct value")
+ self.assertEqual(val, "Default value",
+ "Registry didn't give back the correct value")
key = OpenKey(root_key, test_key_name)
# Read the sub-keys
@@ -134,19 +134,19 @@
self.assertIn(data, test_data,
"Didn't read back the correct test data")
index = index + 1
- self.assertEquals(index, len(test_data),
- "Didn't read the correct number of items")
+ self.assertEqual(index, len(test_data),
+ "Didn't read the correct number of items")
# Check I can directly access each item
for value_name, value_data, value_type in test_data:
read_val, read_typ = QueryValueEx(sub_key, value_name)
- self.assertEquals(read_val, value_data,
- "Could not directly read the value")
- self.assertEquals(read_typ, value_type,
- "Could not directly read the value")
+ self.assertEqual(read_val, value_data,
+ "Could not directly read the value")
+ self.assertEqual(read_typ, value_type,
+ "Could not directly read the value")
sub_key.Close()
# Enumerate our main key.
read_val = EnumKey(key, 0)
- self.assertEquals(read_val, "sub_key", "Read subkey value wrong")
+ self.assertEqual(read_val, "sub_key", "Read subkey value wrong")
try:
EnumKey(key, 1)
self.fail("Was able to get a second key when I only have one!")
@@ -165,8 +165,8 @@
DeleteValue(sub_key, value_name)
nkeys, nvalues, since_mod = QueryInfoKey(sub_key)
- self.assertEquals(nkeys, 0, "subkey not empty before delete")
- self.assertEquals(nvalues, 0, "subkey not empty before delete")
+ self.assertEqual(nkeys, 0, "subkey not empty before delete")
+ self.assertEqual(nvalues, 0, "subkey not empty before delete")
sub_key.Close()
DeleteKey(key, "sub_key")
@@ -326,8 +326,8 @@
with OpenKey(HKEY_LOCAL_MACHINE, "Software") as key:
# HKLM\Software is redirected but not reflected in all OSes
self.assertTrue(QueryReflectionKey(key))
- self.assertEquals(None, EnableReflectionKey(key))
- self.assertEquals(None, DisableReflectionKey(key))
+ self.assertEqual(None, EnableReflectionKey(key))
+ self.assertEqual(None, DisableReflectionKey(key))
self.assertTrue(QueryReflectionKey(key))
@unittest.skipUnless(HAS_REFLECTION, "OS doesn't support reflection")