Beispiel #1
0
 def test_z(self):
     from _testcapi import getargs_z
     self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')
     self.assertRaises(ValueError, getargs_z, 'nul:\0')
     self.assertRaises(TypeError, getargs_z, b'bytes')
     self.assertRaises(TypeError, getargs_z, bytearray(b'bytearray'))
     self.assertRaises(TypeError, getargs_z, memoryview(b'memoryview'))
     self.assertIsNone(getargs_z(None))
Beispiel #2
0
 def test_z(self):
     from _testcapi import getargs_z
     self.assertEqual(getargs_z('abc\xe9'), b'abc\xc3\xa9')
     self.assertRaises(TypeError, getargs_z, 'nul:\0')
     self.assertRaises(TypeError, getargs_z, b'bytes')
     self.assertRaises(TypeError, getargs_z, bytearray(b'bytearray'))
     self.assertRaises(TypeError, getargs_z, memoryview(b'memoryview'))
     self.assertIsNone(getargs_z(None))
Beispiel #3
0
    def test_z(self):
        from _testcapi import getargs_z

        self.assertEqual(getargs_z("abc\xe9"), b"abc\xc3\xa9")
        self.assertRaises(ValueError, getargs_z, "nul:\0")
        self.assertRaises(TypeError, getargs_z, b"bytes")
        self.assertRaises(TypeError, getargs_z, bytearray(b"bytearray"))
        self.assertRaises(TypeError, getargs_z, memoryview(b"memoryview"))
        self.assertIsNone(getargs_z(None))
 def test_z(self):
     from _testcapi import getargs_z
     self.assertEqual(getargs_z('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_z(u'abc'), 'abc')
     self.assertRaises(TypeError, getargs_z, 'nul:\0')
     self.assertRaises(TypeError, getargs_z, u'nul:\0')
     self.assertRaises(TypeError, getargs_z, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_z, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertRaises(TypeError, getargs_z, buffer('buffer'))
     self.assertIsNone(getargs_z(None))
Beispiel #5
0
 def test_z(self):
     from _testcapi import getargs_z
     self.assertEqual(getargs_z('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_z(u'abc'), 'abc')
     self.assertRaises(TypeError, getargs_z, 'nul:\0')
     self.assertRaises(TypeError, getargs_z, u'nul:\0')
     self.assertRaises(TypeError, getargs_z, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_z, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertRaises(TypeError, getargs_z, buffer('buffer'))
     self.assertIsNone(getargs_z(None))