Skip to content

Commit

Permalink
Update docs and doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
samfoo committed Sep 24, 2015
1 parent d9a0fd4 commit ff5be88
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 33 deletions.
64 changes: 31 additions & 33 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,34 @@ do something like the following:
>>> screen = vt102.screen((24,80))
>>> screen.attach(stream)
>>> stream.process(u"\u001b7\u001b[?47h\u001b)0\u001b[H\u001b[2J\u001b[H" +
u"\u001b[2;1HNetHack, Copyright 1985-2003\r\u001b[3;1" +
u"H By Stichting Mathematisch Centrum and M. " +
u"Stephenson.\r\u001b[4;1H See license for de" +
u"tails.\r\u001b[5;1H\u001b[6;1H\u001b[7;1HShall I pi" +
u"ck a character's race, role, gender and alignment f" +
u"or you? [ynq] ")
>>> screen.display
[' ',
'NetHack, Copyright 1985-2003 ',
' By Stichting Mathematisch Centrum and M. Stephenson. ',
' See license for details. ',
' ',
' ',
"Shall I pick a character's race, role, gender and alignment for you? [ynq] ",
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ',
' ']
>>>
... u"\u001b[2;1HNetHack, Copyright 1985-2003\r\u001b[3;1" +
... u"H By Stichting Mathematisch Centrum and M. " +
... u"Stephenson.\r\u001b[4;1H See license for de" +
... u"tails.\r\u001b[5;1H\u001b[6;1H\u001b[7;1HShall I pi" +
... u"ck a character's race, role, gender and alignment f" +
... u"or you? [ynq] ")
>>> print(screen)
[" ",
"NetHack, Copyright 1985-2003 ",
" By Stichting Mathematisch Centrum and M. Stephenson. ",
" See license for details. ",
" ",
" ",
"Shall I pick a character's race, role, gender and alignment for you? [ynq] ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "]
40 changes: 40 additions & 0 deletions vt102/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,46 @@
" ",
" ",
" "]
Here's a real-world example:
>>> import vt102
>>> stream = vt102.stream()
>>> screen = vt102.screen((24,80))
>>> screen.attach(stream)
>>> stream.process(u"\\u001b7\\u001b[?47h\\u001b)0\\u001b[H\\u001b[2J\\u001b[H" +
... u"\\u001b[2;1HNetHack, Copyright 1985-2003\\r\\u001b[3;1" +
... u"H By Stichting Mathematisch Centrum and M. " +
... u"Stephenson.\\r\\u001b[4;1H See license for de" +
... u"tails.\\r\\u001b[5;1H\\u001b[6;1H\\u001b[7;1HShall I pi" +
... u"ck a character's race, role, gender and alignment f" +
... u"or you? [ynq] ")
>>> print(screen)
[" ",
"NetHack, Copyright 1985-2003 ",
" By Stichting Mathematisch Centrum and M. Stephenson. ",
" See license for details. ",
" ",
" ",
"Shall I pick a character's race, role, gender and alignment for you? [ynq] ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "]
>>>
"""

import string
Expand Down

0 comments on commit ff5be88

Please sign in to comment.