Esempio n. 1
0
 def test_s_hash(self):
     from _testcapi import getargs_s_hash
     self.assertEqual(getargs_s_hash('abc\xe9'), b'abc\xc3\xa9')
     self.assertEqual(getargs_s_hash('nul:\0'), b'nul:\0')
     self.assertEqual(getargs_s_hash(b'bytes'), b'bytes')
     self.assertRaises(TypeError, getargs_s_hash, bytearray(b'bytearray'))
     self.assertRaises(TypeError, getargs_s_hash, memoryview(b'memoryview'))
     self.assertRaises(TypeError, getargs_s_hash, None)
Esempio n. 2
0
 def test_s_hash(self):
     from _testcapi import getargs_s_hash
     self.assertEqual(getargs_s_hash('abc\xe9'), b'abc\xc3\xa9')
     self.assertEqual(getargs_s_hash('nul:\0'), b'nul:\0')
     self.assertEqual(getargs_s_hash(b'bytes'), b'bytes')
     self.assertRaises(TypeError, getargs_s_hash, bytearray(b'bytearray'))
     self.assertRaises(TypeError, getargs_s_hash, memoryview(b'memoryview'))
     self.assertRaises(TypeError, getargs_s_hash, None)
Esempio n. 3
0
    def test_s_hash(self):
        from _testcapi import getargs_s_hash

        self.assertEqual(getargs_s_hash("abc\xe9"), b"abc\xc3\xa9")
        self.assertEqual(getargs_s_hash("nul:\0"), b"nul:\0")
        self.assertEqual(getargs_s_hash(b"bytes"), b"bytes")
        self.assertRaises(TypeError, getargs_s_hash, bytearray(b"bytearray"))
        self.assertRaises(TypeError, getargs_s_hash, memoryview(b"memoryview"))
        self.assertRaises(TypeError, getargs_s_hash, None)
Esempio n. 4
0
 def test_s_hash(self):
     from _testcapi import getargs_s_hash
     self.assertEqual(getargs_s_hash('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_s_hash(u'abc'), 'abc')
     self.assertEqual(getargs_s_hash('nul:\0'), 'nul:\0')
     self.assertEqual(getargs_s_hash(u'nul:\0'), 'nul:\0')
     self.assertRaises(TypeError, getargs_s_hash, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_s_hash, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertEqual(getargs_s_hash(buffer('abc\xe9')), 'abc\xe9')
         self.assertEqual(getargs_s_hash(buffer(u'abc\xe9')),
                          str(buffer(u'abc\xe9')))
     self.assertRaises(TypeError, getargs_s_hash, None)
Esempio n. 5
0
 def test_s_hash(self):
     from _testcapi import getargs_s_hash
     self.assertEqual(getargs_s_hash('abc\xe9'), 'abc\xe9')
     self.assertEqual(getargs_s_hash(u'abc'), 'abc')
     self.assertEqual(getargs_s_hash('nul:\0'), 'nul:\0')
     self.assertEqual(getargs_s_hash(u'nul:\0'), 'nul:\0')
     self.assertRaises(TypeError, getargs_s_hash, bytearray('bytearray'))
     self.assertRaises(TypeError, getargs_s_hash, memoryview('memoryview'))
     with test_support.check_py3k_warnings():
         self.assertEqual(getargs_s_hash(buffer('abc\xe9')), 'abc\xe9')
         self.assertEqual(getargs_s_hash(buffer(u'abc\xe9')),
                          str(buffer(u'abc\xe9')))
     self.assertRaises(TypeError, getargs_s_hash, None)