source_tree = Directory(id=0a7b61ef5780b03aa274d11069564980246445ce, entries=[b'some-binary', b'link-to-another-quote', b'foo', b'toexclude', b'bar', b'link-to-foo'])
source_tree_dirs = [PosixPath('foo'), PosixPath('toexclude'), PosixPath('bar'), PosixPath('bar/barfoo2'), PosixPath('bar/barfoo')]
nodes_data = {'swh:1:dir:0a7b61ef5780b03aa274d11069564980246445ce': {'known': True}, 'swh:1:cnt:68769579c3eaadbe555379b9c3538e6628b...ad2b4ac318535b84901ebb1f6b638': {'known': True}, 'swh:1:cnt:19102815663d23f8b75a47e7a01965dcdc96468c': {'known': True}}
def test_generate_df_from_dirs(source_tree, source_tree_dirs, nodes_data):
root = Path(source_tree.data["path"].decode())
dirs = [Path(dir_path) for dir_path in source_tree_dirs]
dirs_data = get_directory_data(root, source_tree, nodes_data)
max_depth = compute_max_depth(dirs)
metrics_columns = ["contents", "known"]
levels_columns = ["lev" + str(i) for i in range(max_depth)]
df_columns = levels_columns + metrics_columns
actual_df = generate_df_from_dirs(dirs_data, df_columns, max_depth)
# assert root doesn't have subdir in level 0
> assert actual_df["lev0"][0] == "bar"
E AssertionError: assert 'foo' == 'bar'
E - bar
E + foo
.tox/py3/lib/python3.7/site-packages/swh/scanner/tests/test_plot.py:34: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jul 2 2021, 7:34 PM