Skip to content

Commit

Permalink
tests: test code page encoding/decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lazka committed Aug 24, 2016
1 parent 6b02775 commit 0984110
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from senf._winansi import ansi_parse, ansi_split
from senf._stdlib import _get_userdir
from senf._fsnative import _encoding
from senf._print import _encode_codepage, _decode_codepage


is_wine = "WINEDEBUG" in os.environ
Expand Down Expand Up @@ -259,6 +260,16 @@ def test_print_error():
print_(sep=4)


@pytest.mark.skipif(os.name != "nt", reason="windows only")
def test_win_cp_encodings():
assert _encode_codepage(437, u"foo") == b"foo"
assert _encode_codepage(437, u"\xe4") == b"\x84"
assert _encode_codepage(437, u"") == b""
assert _decode_codepage(437, b"foo") == u"foo"
assert _decode_codepage(437, b"\x84") == u"\xe4"
assert _decode_codepage(437, b"") == u""


@pytest.mark.skipif(os.name == "nt" or PY2, reason="unix+py3 only")
def test_print_strict_strio():
f = StringIO()
Expand Down

0 comments on commit 0984110

Please sign in to comment.