diff options
Diffstat (limited to 'Lib/ctypes/test/test_parameters.py')
-rw-r--r-- | Lib/ctypes/test/test_parameters.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py index e83fd9a6fc..12b5bd5fba 100644 --- a/Lib/ctypes/test/test_parameters.py +++ b/Lib/ctypes/test/test_parameters.py @@ -54,7 +54,7 @@ class SimpleTypesTestCase(unittest.TestCase): # c_char_p.from_param on a Python String packs the string # into a cparam object s = b"123" - self.assertTrue(c_char_p.from_param(s)._obj is s) + self.assertIs(c_char_p.from_param(s)._obj, s) # new in 0.9.1: convert (encode) unicode to ascii self.assertEqual(c_char_p.from_param(b"123")._obj, b"123") @@ -64,7 +64,7 @@ class SimpleTypesTestCase(unittest.TestCase): # calling c_char_p.from_param with a c_char_p instance # returns the argument itself: a = c_char_p(b"123") - self.assertTrue(c_char_p.from_param(a) is a) + self.assertIs(c_char_p.from_param(a), a) def test_cw_strings(self): from ctypes import byref @@ -73,13 +73,10 @@ class SimpleTypesTestCase(unittest.TestCase): except ImportError: ## print "(No c_wchar_p)" return - s = "123" - if sys.platform == "win32": - self.assertTrue(c_wchar_p.from_param(s)._obj is s) - self.assertRaises(TypeError, c_wchar_p.from_param, 42) - # new in 0.9.1: convert (decode) ascii to unicode - self.assertEqual(c_wchar_p.from_param("123")._obj, "123") + c_wchar_p.from_param("123") + + self.assertRaises(TypeError, c_wchar_p.from_param, 42) self.assertRaises(TypeError, c_wchar_p.from_param, b"123\377") pa = c_wchar_p.from_param(c_wchar_p("123")) |