Python codecs.readbuffer_encode() Examples

The following are 28 code examples of codecs.readbuffer_encode(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module codecs , or try the search function .
Example #1
Source File: test_codecs.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #2
Source File: test_codecs.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #3
Source File: test_codecs.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), ("", 0)) 
Example #4
Source File: test_codecs.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("c", "spam")),
            ("spam", 4)
        ) 
Example #5
Source File: test_codecs.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #6
Source File: test_codecs.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), ("", 0)) 
Example #7
Source File: test_codecs.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("c", "spam")),
            ("spam", 4)
        ) 
Example #8
Source File: test_codecs.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #9
Source File: test_codecs.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), (b"", 0)) 
Example #10
Source File: test_codecs.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("b", b"spam")),
            (b"spam", 4)
        ) 
Example #11
Source File: test_codecs.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #12
Source File: test_codecs.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), ("", 0)) 
Example #13
Source File: test_codecs.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("c", "spam")),
            ("spam", 4)
        ) 
Example #14
Source File: test_codecs.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_readbuffer_encode(self):
        self.assertEqual(codecs.readbuffer_encode("abc\u20ac"), (b"abc\xe2\x82\xac", 6))
        self.assertEqual(codecs.readbuffer_encode("abc\u20ac", None), (b"abc\xe2\x82\xac", 6))
        self.assertRaises(UnicodeEncodeError, codecs.readbuffer_encode, "\uDDDD", 'ignore')

        self.assertEqual(codecs.readbuffer_encode(b"abc\xff"), (b"abc\xff", 4))
        self.assertEqual(codecs.readbuffer_encode(b"abc\xff", None), (b"abc\xff", 4))
        self.assertEqual(codecs.readbuffer_encode(array.array('I', (1633771873,))), (b"aaaa", 4)) 
Example #15
Source File: test_codecs.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("c", "spam")),
            ("spam", 4)
        ) 
Example #16
Source File: test_codecs.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), (b"", 0)) 
Example #17
Source File: test_codecs.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("b", b"spam")),
            (b"spam", 4)
        ) 
Example #18
Source File: test_codecs.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #19
Source File: test_codecs.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), (b"", 0)) 
Example #20
Source File: test_codecs.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("b", b"spam")),
            (b"spam", 4)
        ) 
Example #21
Source File: test_codecs.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #22
Source File: test_codecs.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), ("", 0)) 
Example #23
Source File: test_codecs.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("c", "spam")),
            ("spam", 4)
        ) 
Example #24
Source File: test_codecs.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #25
Source File: test_codecs.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), ("", 0)) 
Example #26
Source File: test_codecs.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_array(self):
        import array
        self.assertEqual(
            codecs.readbuffer_encode(array.array("c", "spam")),
            ("spam", 4)
        ) 
Example #27
Source File: test_codecs.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_bad_args(self):
        self.assertRaises(TypeError, codecs.readbuffer_encode)
        self.assertRaises(TypeError, codecs.readbuffer_encode, 42) 
Example #28
Source File: test_codecs.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_empty(self):
        self.assertEqual(codecs.readbuffer_encode(""), ("", 0))