equal
deleted
inserted
replaced
31 def test_init(self): |
31 def test_init(self): |
32 Binary() |
32 Binary() |
33 Binary(b'toto') |
33 Binary(b'toto') |
34 Binary(bytearray(b'toto')) |
34 Binary(bytearray(b'toto')) |
35 if PY2: |
35 if PY2: |
36 Binary(buffer('toto')) |
36 Binary(buffer('toto')) # noqa: F821 |
37 else: |
37 else: |
38 Binary(memoryview(b'toto')) |
38 Binary(memoryview(b'toto')) |
39 with self.assertRaises((AssertionError, TypeError)): |
39 with self.assertRaises((AssertionError, TypeError)): |
40 # TypeError is raised by BytesIO if python runs with -O |
40 # TypeError is raised by BytesIO if python runs with -O |
41 Binary(u'toto') |
41 Binary(u'toto') |
43 def test_write(self): |
43 def test_write(self): |
44 b = Binary() |
44 b = Binary() |
45 b.write(b'toto') |
45 b.write(b'toto') |
46 b.write(bytearray(b'toto')) |
46 b.write(bytearray(b'toto')) |
47 if PY2: |
47 if PY2: |
48 b.write(buffer('toto')) |
48 b.write(buffer('toto')) # noqa: F821 |
49 else: |
49 else: |
50 b.write(memoryview(b'toto')) |
50 b.write(memoryview(b'toto')) |
51 with self.assertRaises((AssertionError, TypeError)): |
51 with self.assertRaises((AssertionError, TypeError)): |
52 # TypeError is raised by BytesIO if python runs with -O |
52 # TypeError is raised by BytesIO if python runs with -O |
53 b.write(u'toto') |
53 b.write(u'toto') |