def test_store_path_filtered(glob): project = Project.objects.get(code="project0") stores = Store.objects.filter(translation_project__project=project) path_filter = StorePathFilter(glob) if not glob: assert path_filter.filtered(stores) is stores else: assert (list(path_filter.filtered(stores)) == list( stores.filter(pootle_path__regex=path_filter.pootle_regex)))
def test_store_path_filtered(glob): project = Project.objects.get(code="project0") stores = Store.objects.filter( translation_project__project=project) path_filter = StorePathFilter(glob) if not glob: assert path_filter.filtered(stores) is stores else: assert ( list(path_filter.filtered(stores)) == list(stores.filter(pootle_path__regex=path_filter.pootle_regex)))
def test_store_path_filter_instance(): path_filter = StorePathFilter() assert path_filter.pootle_path is None assert path_filter.pootle_regex is None assert not hasattr(path_filter, "fs_path") assert not hasattr(path_filter, "fs_regex") # regexes are cached path_filter.pootle_path = "/foo" path_filter.fs_path = "/bar" assert path_filter.pootle_regex is None del path_filter.__dict__["pootle_regex"] assert (path_filter.pootle_regex == path_filter.path_regex( path_filter.pootle_path))
def test_store_path_filter_instance(): path_filter = StorePathFilter() assert path_filter.pootle_path is None assert path_filter.pootle_regex is None assert not hasattr(path_filter, "fs_path") assert not hasattr(path_filter, "fs_regex") # regexes are cached path_filter.pootle_path = "/foo" path_filter.fs_path = "/bar" assert path_filter.pootle_regex is None del path_filter.__dict__["pootle_regex"] assert ( path_filter.pootle_regex == path_filter.path_regex(path_filter.pootle_path))