Skip to content

Commit 0c22e77

Browse files
committed
Remove six completely.
1 parent 63eab50 commit 0c22e77

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

test/test_pack.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# coding: utf-8
3+
from __future__ import absolute_import, division, print_function, unicode_literals
34

4-
import six
55
import struct
66
from pytest import raises, xfail
77

@@ -28,24 +28,22 @@ def testPack():
2828
check(td)
2929

3030
def testPackUnicode():
31-
test_data = [
32-
six.u(""), six.u("abcd"), [six.u("defgh")], six.u("Русский текст"),
33-
]
31+
test_data = ["", "abcd", ["defgh"], "Русский текст"]
3432
for td in test_data:
3533
re = unpackb(packb(td, encoding='utf-8'), use_list=1, encoding='utf-8')
3634
assert re == td
3735
packer = Packer(encoding='utf-8')
3836
data = packer.pack(td)
39-
re = Unpacker(BytesIO(data), encoding='utf-8', use_list=1).unpack()
37+
re = Unpacker(BytesIO(data), encoding=str('utf-8'), use_list=1).unpack()
4038
assert re == td
4139

4240
def testPackUTF32():
4341
try:
4442
test_data = [
45-
six.u(""),
46-
six.u("abcd"),
47-
[six.u("defgh")],
48-
six.u("Русский текст"),
43+
"",
44+
"abcd",
45+
["defgh"],
46+
"Русский текст",
4947
]
5048
for td in test_data:
5149
re = unpackb(packb(td, encoding='utf-32'), use_list=1, encoding='utf-32')
@@ -70,23 +68,23 @@ def testStrictUnicodeUnpack():
7068

7169
def testStrictUnicodePack():
7270
with raises(UnicodeEncodeError):
73-
packb(six.u("abc\xeddef"), encoding='ascii', unicode_errors='strict')
71+
packb("abc\xeddef", encoding='ascii', unicode_errors='strict')
7472

7573
def testIgnoreErrorsPack():
76-
re = unpackb(packb(six.u("abcФФФdef"), encoding='ascii', unicode_errors='ignore'), encoding='utf-8', use_list=1)
77-
assert re == six.u("abcdef")
74+
re = unpackb(packb("abcФФФdef", encoding='ascii', unicode_errors='ignore'), encoding='utf-8', use_list=1)
75+
assert re == "abcdef"
7876

7977
def testNoEncoding():
8078
with raises(TypeError):
81-
packb(six.u("abc"), encoding=None)
79+
packb("abc", encoding=None)
8280

8381
def testDecodeBinary():
84-
re = unpackb(packb("abc"), encoding=None, use_list=1)
82+
re = unpackb(packb(b"abc"), encoding=None, use_list=1)
8583
assert re == b"abc"
8684

8785
def testPackFloat():
88-
assert packb(1.0, use_single_float=True) == b'\xca' + struct.pack('>f', 1.0)
89-
assert packb(1.0, use_single_float=False) == b'\xcb' + struct.pack('>d', 1.0)
86+
assert packb(1.0, use_single_float=True) == b'\xca' + struct.pack(str('>f'), 1.0)
87+
assert packb(1.0, use_single_float=False) == b'\xcb' + struct.pack(str('>d'), 1.0)
9088

9189
def testArraySize(sizes=[0, 5, 50, 1000]):
9290
bio = BytesIO()

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ envlist = py26,py27,py32,py33,pypy
44
[testenv]
55
deps=
66
pytest
7-
six
87

98
commands=py.test test

0 commit comments

Comments
 (0)