예제 #1
0
 def test_t_hash(self):
     from _testcapi import getargs_t_hash
     self.assertEqual(getargs_t_hash('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_t_hash(u'abc'), 'abc')
     self.assertEqual(getargs_t_hash('nul:\0'), 'nul:\0')
     self.assertEqual(getargs_t_hash(u'nul:\0'), 'nul:\0')
     self.assertRaises(TypeError, getargs_t_hash, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_t_hash, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertEqual(getargs_t_hash(buffer('abc\xe9')), 'abc\xe9')
         self.assertEqual(getargs_t_hash(buffer(u'abc')), 'abc')
     self.assertRaises(TypeError, getargs_t_hash, None)
예제 #2
0
 def test_t_hash(self):
     from _testcapi import getargs_t_hash
     self.assertEqual(getargs_t_hash('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_t_hash(u'abc'), 'abc')
     self.assertEqual(getargs_t_hash('nul:\0'), 'nul:\0')
     self.assertEqual(getargs_t_hash(u'nul:\0'), 'nul:\0')
     self.assertRaises(TypeError, getargs_t_hash, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_t_hash, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertEqual(getargs_t_hash(buffer('abc\xe9')), 'abc\xe9')
         self.assertEqual(getargs_t_hash(buffer(u'abc')), 'abc')
     self.assertRaises(TypeError, getargs_t_hash, None)