Skip to content

Commit

Permalink
dev(narugo): add unittest for tree cli
Browse files Browse the repository at this point in the history
  • Loading branch information
narugo1992 committed Aug 19, 2024
1 parent 28f1d5c commit daf43a7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/entry/test_tree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from pprint import pprint

import click
import pytest
from hbutils.testing import simulate_entry
Expand All @@ -16,6 +14,7 @@ def test_simple_tree_1(self):
])
assert result.exitcode == 0
lines = click.unstyle(result.stdout).strip().splitlines(keepends=False)
lines = list(filter(bool, lines))
assert lines == [
'datasets/deepghs/test_nested_dataset@main/.',
'├── README.md',
Expand Down Expand Up @@ -66,6 +65,7 @@ def test_simple_tree_all(self):
])
assert result.exitcode == 0
lines = click.unstyle(result.stdout).strip().splitlines(keepends=False)
lines = list(filter(bool, lines))
assert lines == [
'datasets/deepghs/test_nested_dataset@main/.',
'├── .gitattributes',
Expand Down Expand Up @@ -117,6 +117,7 @@ def test_tree_subdir_1(self):
])
assert result.exitcode == 0
lines = click.unstyle(result.stdout).strip().splitlines(keepends=False)
lines = list(filter(bool, lines))
assert lines == [
"datasets/deepghs/test_nested_dataset@main/images",
"├── 20240808",
Expand Down Expand Up @@ -146,6 +147,7 @@ def test_tree_subdir_2(self):
])
assert result.exitcode == 0
lines = click.unstyle(result.stdout).strip().splitlines(keepends=False)
lines = list(filter(bool, lines))
assert lines == [
"datasets/deepghs/test_nested_dataset@main/samples",
"├── colored",
Expand All @@ -171,9 +173,8 @@ def test_tree_subdir_3(self):
'-d', 'samples/colored'
])
assert result.exitcode == 0
text = click.unstyle(result.stdout).strip()
pprint(text)
lines = click.unstyle(result.stdout).strip().splitlines(keepends=False)
lines = list(filter(bool, lines))
assert lines == [
"datasets/deepghs/test_nested_dataset@main/samples/colored",
"├── 0.webp",
Expand Down

0 comments on commit daf43a7

Please sign in to comment.