Ejemplo n.º 1
0
    def test_filter_from_glob_should_keep_regexp_match(self):
        regexp = "foo.bar.*"
        matching_name_1 = "foo.bar.baz"
        matching_name_2 = "foo.bar.qux"

        filtered = bg_glob.filter_from_glob([matching_name_1, matching_name_2], regexp)

        self.assertEqual([matching_name_1, matching_name_2], filtered)
Ejemplo n.º 2
0
    def test_filter_from_glob_should_keep_regexp_match(self):
        regexp = "foo.bar.*"
        matching_name_1 = "foo.bar.baz"
        matching_name_2 = "foo.bar.qux"

        filtered = bg_glob.filter_from_glob([matching_name_1, matching_name_2],
                                            regexp)

        self.assertEqual([matching_name_1, matching_name_2], filtered)
Ejemplo n.º 3
0
    def test_filter_from_glob_should_remove_regexp_match(self):
        regexp = "foo.bar.*"
        matching_name = "foo.bar.baz"
        not_matching_name_1 = "bar.foo.qux"
        not_matching_name_2 = "bar.foo.quux"

        filtered = bg_glob.filter_from_glob(
            [matching_name, not_matching_name_1, not_matching_name_2], regexp)

        self.assertEqual([matching_name], filtered)
Ejemplo n.º 4
0
    def test_filter_from_glob_should_remove_regexp_match(self):
        regexp = "foo.bar.*"
        matching_name = "foo.bar.baz"
        not_matching_name_1 = "bar.foo.qux"
        not_matching_name_2 = "bar.foo.quux"

        filtered = bg_glob.filter_from_glob(
            [matching_name, not_matching_name_1, not_matching_name_2], regexp
        )

        self.assertEqual([matching_name], filtered)
Ejemplo n.º 5
0
 def test_filter_from_glob_should_keep_exact_match(self):
     name = "foo.bar.baz"
     filtered = bg_glob.filter_from_glob([name], name)
     self.assertEqual([name], filtered)
Ejemplo n.º 6
0
 def test_filter_from_glob_should_keep_exact_match(self):
     name = "foo.bar.baz"
     filtered = bg_glob.filter_from_glob([name], name)
     self.assertEqual([name], filtered)
Ejemplo n.º 7
0
 def glob_directory_names(self, glob, start_time=None, end_time=None):
     """See the real Accessor for a description."""
     super(_MemoryAccessor, self).glob_directory_names(glob)
     directory_names = iter(self.__glob_names(self._directory_names, glob))
     return bg_glob.filter_from_glob(directory_names, glob)
Ejemplo n.º 8
0
 def glob_directory_names(self, glob, start_time=None, end_time=None):
     """See the real Accessor for a description."""
     super(_MemoryAccessor, self).glob_directory_names(glob)
     directory_names = iter(self.__glob_names(self._directory_names, glob))
     return bg_glob.filter_from_glob(directory_names, glob)