Exemple #1
0
    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"])
Exemple #2
0
    def testSimple(self):
        path = "fooba{r,z}"

        results = list(globbing.ExpandGroups(path))
        self.assertCountEqual(results, [
            "foobar",
            "foobaz",
        ])
Exemple #3
0
    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"),
        ])
Exemple #4
0
    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"),
        ])
Exemple #5
0
    def testNoGroup(self):
        path = os.path.join("foobarbaz")

        results = list(globbing.ExpandGroups(path))
        self.assertCountEqual(results, ["foobarbaz"])
Exemple #6
0
    def testEscaped(self):
        path = os.path.join("foo\\{baz}bar")

        results = list(globbing.ExpandGroups(path))
        self.assertCountEqual(results, ["foo\\{baz}bar"])
Exemple #7
0
    def testSingleton(self):
        path = os.path.join("foo{bar}baz")

        results = list(globbing.ExpandGroups(path))
        self.assertCountEqual(results, ["foo{bar}baz"])
Exemple #8
0
    def testEmpty(self):
        path = os.path.join("foo{}bar")

        results = list(globbing.ExpandGroups(path))
        self.assertItemsEqual(results, ["foo{}bar"])