def test_select_include_any_tags(self): config = selector._SelectorConfig(roots=[ "dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js" ], include_with_any_tags=["tag1"]) selected = self.selector.select(config) self.assertEqual([], selected)
def test_select_include_files(self): config = selector._SelectorConfig( roots=[ "dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js" ], include_files=["dir/subdir2/test21.js"]) selected = self.selector.select(config) self.assertEqual(["dir/subdir2/test21.js"], selected)
def test_select_include_files(self): config = selector._SelectorConfig( roots=["dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js"], include_files=["dir/subdir2/test21.js"]) selected, excluded = self.selector.select(config) self.assertEqual(["dir/subdir2/test21.js"], selected) self.assertEqual( ["dir/subdir1/test11.js", "dir/subdir1/test12.js", "dir/subdir3/a/test3a1.js"], excluded)
def test_select_all(self): config = selector._SelectorConfig(roots=[ "dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js" ]) selected = self.selector.select(config) self.assertEqual([ "dir/subdir1/test11.js", "dir/subdir1/test12.js", "dir/subdir2/test21.js", "dir/subdir3/a/test3a1.js" ], selected)
def test_select_include_tags(self): config = selector._SelectorConfig( roots=["dir/subdir1/*.js", "dir/subdir2/*.js", "dir/subdir3/a/*.js"], include_tags="tag1") selected, excluded = self.selector.select(config) self.assertEqual([], selected) self.assertEqual([ "dir/subdir1/test11.js", "dir/subdir1/test12.js", "dir/subdir2/test21.js", "dir/subdir3/a/test3a1.js" ], excluded)
def test_include_exclude_tags(self): with self.assertRaises(ValueError): selector._SelectorConfig(include_tags="tag1", exclude_tags="tag2")
def test_root_roots(self): with self.assertRaises(ValueError): selector._SelectorConfig(root="path_to_root", roots=["test1", "test2"])