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

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