Пример #1
0
 def test_c(self):
     from _testcapi import getargs_c
     self.assertRaises(TypeError, getargs_c, b'abc')  # len > 1
     self.assertEqual(getargs_c(b'a'), b'a')
     self.assertEqual(getargs_c(bytearray(b'a')), b'a')
     self.assertRaises(TypeError, getargs_c, memoryview(b'a'))
     self.assertRaises(TypeError, getargs_c, 's')
     self.assertRaises(TypeError, getargs_c, None)
Пример #2
0
 def test_c(self):
     from _testcapi import getargs_c
     self.assertRaises(TypeError, getargs_c, b'abc')  # len > 1
     self.assertEqual(getargs_c(b'a'), b'a')
     self.assertEqual(getargs_c(bytearray(b'a')), b'a')
     self.assertRaises(TypeError, getargs_c, memoryview(b'a'))
     self.assertRaises(TypeError, getargs_c, 's')
     self.assertRaises(TypeError, getargs_c, None)
Пример #3
0
    def test_c(self):
        from _testcapi import getargs_c

        self.assertRaises(TypeError, getargs_c, b"abc")  # len > 1
        self.assertEqual(getargs_c(b"a"), 97)
        self.assertEqual(getargs_c(bytearray(b"a")), 97)
        self.assertRaises(TypeError, getargs_c, memoryview(b"a"))
        self.assertRaises(TypeError, getargs_c, "s")
        self.assertRaises(TypeError, getargs_c, 97)
        self.assertRaises(TypeError, getargs_c, None)
Пример #4
0
 def test_c(self):
     from _testcapi import getargs_c
     self.assertRaises(TypeError, getargs_c, 'abc')  # len > 1
     self.assertEqual(getargs_c('a'), 97)
     if test_support.have_unicode:
         self.assertRaises(TypeError, getargs_c, u's')
     self.assertRaises(TypeError, getargs_c, bytearray('a'))
     self.assertRaises(TypeError, getargs_c, memoryview('a'))
     with test_support.check_py3k_warnings():
         self.assertRaises(TypeError, getargs_c, buffer('a'))
     self.assertRaises(TypeError, getargs_c, 97)
     self.assertRaises(TypeError, getargs_c, None)
Пример #5
0
 def test_c(self):
     from _testcapi import getargs_c
     self.assertRaises(TypeError, getargs_c, 'abc')  # len > 1
     self.assertEqual(getargs_c('a'), 97)
     if test_support.have_unicode:
         self.assertRaises(TypeError, getargs_c, u's')
     self.assertRaises(TypeError, getargs_c, bytearray('a'))
     self.assertRaises(TypeError, getargs_c, memoryview('a'))
     with test_support.check_py3k_warnings():
         self.assertRaises(TypeError, getargs_c, buffer('a'))
     self.assertRaises(TypeError, getargs_c, 97)
     self.assertRaises(TypeError, getargs_c, None)