示例#1
0
def test_sub():
    """测试两个集合相减是否正常工作。
    """
    fc1 = FileCollection.from_path(dir_path)
    fc2 = FileCollection.from_path(dir_path)
    fc = fc1 - fc2
    assert fc.howmany == 0
示例#2
0
def test_sub():
    """测试两个集合相减是否正常工作。
    """
    fc1 = FileCollection.from_path(dir_path)
    fc2 = FileCollection.from_path(dir_path)
    fc = fc1 - fc2
    assert fc.howmany == 0
示例#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
示例#4
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
示例#5
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
示例#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
示例#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()
示例#8
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()