From daf43a7959b4ef9d314efca50944e02d131fcdac Mon Sep 17 00:00:00 2001 From: narugo1992 Date: Tue, 20 Aug 2024 01:27:35 +0800 Subject: [PATCH] dev(narugo): add unittest for tree cli --- test/entry/test_tree.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/entry/test_tree.py b/test/entry/test_tree.py index 82d576754f..6d8e6b4d7e 100644 --- a/test/entry/test_tree.py +++ b/test/entry/test_tree.py @@ -1,5 +1,3 @@ -from pprint import pprint - import click import pytest from hbutils.testing import simulate_entry @@ -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', @@ -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', @@ -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", @@ -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", @@ -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",