Ejemplo n.º 1
0
 def test_buffer_encode(self):
     import _codecs, array
     assert _codecs.readbuffer_encode(array.array('c', 'spam')) == ('spam', 4)
     exc = raises(TypeError, _codecs.charbuffer_encode, array.array('c', 'spam'))
     assert str(exc.value) == "must be string or read-only character buffer, not array.array"
     assert _codecs.readbuffer_encode(u"test") == ('test', 4)
     assert _codecs.charbuffer_encode(u"test") == ('test', 4)
Ejemplo n.º 2
0
 def test_buffer_encode(self):
     import _codecs, array
     assert _codecs.readbuffer_encode(array.array('c', 'spam')) == ('spam', 4)
     exc = raises(TypeError, _codecs.charbuffer_encode, array.array('c', 'spam'))
     assert "must be string or read-only character buffer, not array.array" in str(exc.value)
     assert _codecs.readbuffer_encode(u"test") == ('test', 4)
     assert _codecs.charbuffer_encode(u"test") == ('test', 4)
Ejemplo n.º 3
0
 def test_buffer_encode(self):
     import _codecs, array
     assert (_codecs.readbuffer_encode(array.array('b',
                                                   b'spam')) == (b'spam',
                                                                 4))
     assert _codecs.readbuffer_encode(u"test") == (b'test', 4)
     assert _codecs.readbuffer_encode("") == (b"", 0)
Ejemplo n.º 4
0
 def test_array(self):
     import _codecs, array
     _codecs.readbuffer_encode(array.array('c', 'spam')) == ('spam', 4)
Ejemplo n.º 5
0
 def test_array(self):
     import _codecs, array
     _codecs.readbuffer_encode(array.array('c', 'spam')) == ('spam', 4)
Ejemplo n.º 6
0
 def test_buffer_encode(self):
     import _codecs, array
     assert (_codecs.readbuffer_encode(array.array('b', b'spam')) ==
             (b'spam', 4))
     assert _codecs.readbuffer_encode(u"test") == (b'test', 4)
     assert _codecs.readbuffer_encode("") ==  (b"", 0)
Ejemplo n.º 7
0
    def test_array(self):
        import _codecs, array

        _codecs.readbuffer_encode(array.array("c", "spam")) == ("spam", 4)