示例#1
0
 def test_z_hash(self):
     from _testcapi import getargs_z_hash
     self.assertEqual(getargs_z_hash('abc\xe9'), b'abc\xc3\xa9')
     self.assertEqual(getargs_z_hash('nul:\0'), b'nul:\0')
     self.assertEqual(getargs_z_hash(b'bytes'), b'bytes')
     self.assertRaises(TypeError, getargs_z_hash, bytearray(b'bytearray'))
     self.assertRaises(TypeError, getargs_z_hash, memoryview(b'memoryview'))
     self.assertIsNone(getargs_z_hash(None))
示例#2
0
 def test_z_hash(self):
     from _testcapi import getargs_z_hash
     self.assertEqual(getargs_z_hash('abc\xe9'), b'abc\xc3\xa9')
     self.assertEqual(getargs_z_hash('nul:\0'), b'nul:\0')
     self.assertEqual(getargs_z_hash(b'bytes'), b'bytes')
     self.assertRaises(TypeError, getargs_z_hash, bytearray(b'bytearray'))
     self.assertRaises(TypeError, getargs_z_hash, memoryview(b'memoryview'))
     self.assertIsNone(getargs_z_hash(None))
示例#3
0
    def test_z_hash(self):
        from _testcapi import getargs_z_hash

        self.assertEqual(getargs_z_hash("abc\xe9"), b"abc\xc3\xa9")
        self.assertEqual(getargs_z_hash("nul:\0"), b"nul:\0")
        self.assertEqual(getargs_z_hash(b"bytes"), b"bytes")
        self.assertRaises(TypeError, getargs_z_hash, bytearray(b"bytearray"))
        self.assertRaises(TypeError, getargs_z_hash, memoryview(b"memoryview"))
        self.assertIsNone(getargs_z_hash(None))
示例#4
0
 def test_z_hash(self):
     from _testcapi import getargs_z_hash
     self.assertEqual(getargs_z_hash('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_z_hash(u'abc'), 'abc')
     self.assertEqual(getargs_z_hash('nul:\0'), 'nul:\0')
     self.assertEqual(getargs_z_hash(u'nul:\0'), 'nul:\0')
     self.assertRaises(TypeError, getargs_z_hash, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_z_hash, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertEqual(getargs_z_hash(buffer('abc\xe9')), 'abc\xe9')
         self.assertEqual(getargs_z_hash(buffer(u'abc\xe9')),
                          str(buffer(u'abc\xe9')))
     self.assertIsNone(getargs_z_hash(None))
示例#5
0
 def test_z_hash(self):
     from _testcapi import getargs_z_hash
     self.assertEqual(getargs_z_hash('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_z_hash(u'abc'), 'abc')
     self.assertEqual(getargs_z_hash('nul:\0'), 'nul:\0')
     self.assertEqual(getargs_z_hash(u'nul:\0'), 'nul:\0')
     self.assertRaises(TypeError, getargs_z_hash, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_z_hash, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertEqual(getargs_z_hash(buffer('abc\xe9')), 'abc\xe9')
         self.assertEqual(getargs_z_hash(buffer(u'abc\xe9')),
                          str(buffer(u'abc\xe9')))
     self.assertIsNone(getargs_z_hash(None))