-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from plasma.debug import draw, tree, info | ||
|
||
|
||
class TestDebugging: | ||
|
||
def test_tree(self, root, grid): | ||
lines = tree(root).split('\n') | ||
assert lines[0].startswith('root') | ||
assert lines[1].strip().startswith('a') | ||
assert lines[2].strip().startswith('*') | ||
assert lines[3].strip().startswith('b') | ||
|
||
def test_draw(self, root, grid): | ||
a, *_ = grid | ||
root._width = 24 | ||
root._height = 10 | ||
a.payload = 'XXXXXXXXXXXX' | ||
data = draw(root) | ||
assert data == ''' | ||
โโโโโโโโโโโโโโโโโโโโโโโโ | ||
โXXXXXXXXXXโโb.........โ | ||
โ..........โโ..........โ | ||
โ..........โโ..........โ | ||
โ..........โโโโโโโโโโโโโ | ||
โ..........โโโโโโโโโโโโโ | ||
โ..........โโc.โโd.โโe.โ | ||
โ..........โโ..โโ..โโ..โ | ||
โ..........โโ..โโ..โโ..โ | ||
โโโโโโโโโโโโโโโโโโโโโโโโ | ||
'''.replace(' ', '')[1:] | ||
|
||
def test_info(self, root, grid, capsys): | ||
info(root) | ||
out, _ = capsys.readouterr() | ||
assert out == tree(root) + '\n' + draw(root) + '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters