Beispiel #1
0
def test_sub():
    """测试两个集合相减是否正常工作。
    """
    fc1 = FileCollection.from_path(dir_path)
    fc2 = FileCollection.from_path(dir_path)
    fc = fc1 - fc2
    assert fc.howmany == 0
def test_sub():
    """测试两个集合相减是否正常工作。
    """
    fc1 = FileCollection.from_path(dir_path)
    fc2 = FileCollection.from_path(dir_path)
    fc = fc1 - fc2
    assert fc.howmany == 0
Beispiel #3
0
def test_add():
    """测试两个集合相加是否正常工作。
    """
    fc1 = FileCollection.from_path(dir_path)
    fc2 = FileCollection.from_path(dir_path)
    fc3 = FileCollection()
    fc3.add(__file__)

    fc = fc1 + fc2 + fc3
    assert fc.howmany == 5

    fc = FileCollection.sum([fc1, fc2, fc3])
    assert fc.howmany == 5
def test_add():
    """测试两个集合相加是否正常工作。
    """
    fc1 = FileCollection.from_path(dir_path)
    fc2 = FileCollection.from_path(dir_path)
    fc3 = FileCollection()
    fc3.add(__file__)

    fc = fc1 + fc2 + fc3
    assert fc.howmany == 5

    fc = FileCollection.sum([fc1, fc2, fc3])
    assert fc.howmany == 5
def test_from_path():
    fc = FileCollection.from_path(dir_path)
    basename_list = [winfile.basename for winfile in fc.iterfiles()]
    basename_list.sort()
    expect = ["root_file.txt", "root_image.jpg",
              "sub_file.txt", "sub_image.jpg"]
    expect.sort()
    assert basename_list == expect
Beispiel #6
0
def test_from_path():
    fc = FileCollection.from_path(dir_path)
    basename_list = [winfile.basename for winfile in fc.iterfiles()]
    basename_list.sort()
    expect = [
        "root_file.txt", "root_image.jpg", "sub_file.txt", "sub_image.jpg"
    ]
    expect.sort()
    assert basename_list == expect
Beispiel #7
0
def test_sort():
    """测试排序功能是否正常工作。
    """
    fc = FileCollection.from_path(dir_path)
    fc.sort_by_abspath()
    fc.sort_by_dirname()
    fc.sort_by_fname()
    fc.sort_by_ext()
    fc.sort_by_atime()
    fc.sort_by_ctime()
    fc.sort_by_mtime()
    fc.sort_by_size()
def test_sort():
    """测试排序功能是否正常工作。
    """
    fc = FileCollection.from_path(dir_path)
    fc.sort_by_abspath()
    fc.sort_by_dirname()
    fc.sort_by_fname()
    fc.sort_by_ext()
    fc.sort_by_atime()
    fc.sort_by_ctime()
    fc.sort_by_mtime()
    fc.sort_by_size()