Stunner / findmissing

Print out missing numbers in a sequence.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Find Something Other Than StringIO to Capture Output

Stunner opened this issue · comments

commented

There appears to be a bug within Python 2.7.x's version of StringIO. Resolving this would allow for the removal of this workaround code which is necessary for tests to pass.

Sun 07/14 01:50 AM in ~/Documents/findmissing/tests (master)
tsrawat $ python
Python 2.7.15 (default, Jun  9 2018, 17:57:13)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import io
>>> co = io.StringIO()
>>> import sys
>>> sys.stdout = co
>>> sys.path.append('..')
>>> from findmissing import print_diff
>>> print_diff(12, 1, 8, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "../findmissing.py", line 119, in print_diff
    print_last_seen(last_seen)
  File "../findmissing.py", line 92, in print_last_seen
    print(last_seen)
TypeError: unicode argument expected, got 'str'
>>> quit()
Sun 07/14 01:55 AM in ~/Documents/findmissing/tests (master)
tsrawat $ python
Python 2.7.15 (default, Jun  9 2018, 17:57:13)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from findmissing import print_diff
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named findmissing
>>> import sys
>>> sys.path.append('..')
>>> from findmissing import print_diff
>>> print_diff(12, 1, 8, 0)
9
10
11
12
13
14
15
16
17
18
19
20
False