示例#1
0
    def testSimple(self):
        self.Touch("foo", "bar", "0")
        self.Touch("foo", "baz", "0")

        component = globbing.CurrentComponent()

        results = list(component.Generate(self.Path("foo")))
        self.assertCountEqual(results, [self.Path("foo")])

        results = list(component.Generate(self.Path("foo", "bar")))
        self.assertCountEqual(results, [self.Path("foo", "bar")])

        results = list(component.Generate(self.Path("foo", "baz")))
        self.assertCountEqual(results, [self.Path("foo", "baz")])
示例#2
0
    def testSimple(self):
        filepaths = [
            ("foo", "bar", "0"),
            ("foo", "baz", "0"),
        ]

        component = globbing.CurrentComponent()

        with DirHierarchy(filepaths) as hierarchy:
            results = list(component.Generate(hierarchy(("foo", ))))
            self.assertCountEqual(results, [hierarchy(("foo", ))])

            results = list(component.Generate(hierarchy(("foo", "bar"))))
            self.assertCountEqual(results, [hierarchy(("foo", "bar"))])

            results = list(component.Generate(hierarchy(("foo", "baz"))))
            self.assertCountEqual(results, [hierarchy(("foo", "baz"))])