Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
unit-test for unprintable(). last unit-test todo.
Browse files Browse the repository at this point in the history
  • Loading branch information
Buck Golemon committed Dec 10, 2014
1 parent c8c9d85 commit c2dd7b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ NOW: Should probably do before it hits users
* conflict error message
* all requirements already satisfied -> "must specify at least one requirement" error

* resolve all the todo:unit-test notes


LATER: Things that I want to do, but would put me past my deadline:
------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion tests/functional/simple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ def pipe_output(read, write):

def unprintable(mystring):
"""return only the unprintable characters of a string"""
# TODO: unit-test
from string import printable
return ''.join(
character
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/simple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,16 @@ def fakewait():

assert _nonlocal.wait == 0
assert _nonlocal.thrown is True


def test_unprintable():
from functional.simple_test import unprintable
import string
assert unprintable(string.printable) == ''

_ascii = ''.join(chr(i) for i in range(0x80))
assert unprintable(_ascii) == (
'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f'
)

assert set(_ascii) - set(unprintable(_ascii)) == set(string.printable)

0 comments on commit c2dd7b8

Please sign in to comment.