def testUnclosed(self): path = os.path.join("foo{bar") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, ["foo{bar"]) path = os.path.join("foo}bar") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, ["foo}bar"])
def testSimple(self): path = "fooba{r,z}" results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, [ "foobar", "foobaz", ])
def testMany(self): path = os.path.join("foo{bar,baz,quux,norf}thud") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, [ os.path.join("foobarthud"), os.path.join("foobazthud"), os.path.join("fooquuxthud"), os.path.join("foonorfthud"), ])
def testMultiple(self): path = os.path.join("f{o,0}o{bar,baz}", "{quux,norf}") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, [ os.path.join("foobar", "quux"), os.path.join("foobar", "norf"), os.path.join("foobaz", "quux"), os.path.join("foobaz", "norf"), os.path.join("f0obar", "quux"), os.path.join("f0obar", "norf"), os.path.join("f0obaz", "quux"), os.path.join("f0obaz", "norf"), ])
def testNoGroup(self): path = os.path.join("foobarbaz") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, ["foobarbaz"])
def testEscaped(self): path = os.path.join("foo\\{baz}bar") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, ["foo\\{baz}bar"])
def testSingleton(self): path = os.path.join("foo{bar}baz") results = list(globbing.ExpandGroups(path)) self.assertCountEqual(results, ["foo{bar}baz"])
def testEmpty(self): path = os.path.join("foo{}bar") results = list(globbing.ExpandGroups(path)) self.assertItemsEqual(results, ["foo{}bar"])