def test_add_and_remove(): """测试添加WinFile和删除WinFile的方法是否正常工作。 """ fc = FileCollection() fc.add(__file__) assert fc.howmany == 1 fc.remove(__file__) assert fc.howmany == 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