def test_glob(self): scenarii = [ # Single character wildcard ("a?", self._metrics_by_length[1]), # Component wildcard ("*", self._metrics_by_length[1]), ("*.*.c", ["a.b.c", "x.y.c"]), ("a.*.*", ["a.a.a", "a.b.c", "a.b.d"]), ("*.*.*", self._metrics_by_length[3]), # Zero-or-more characters wildcard ("a*", self._metrics_by_length[1]), # Choices ("*.{b,c,d,5}.?", ["a.a.a", "a.b.c", "a.b.d", "x.y.c"]), # Globstar wildcard ("a.**", ["a.a.a", "a.b.c", "a.b.d"]), ] for (glob, metrics) in scenarii: found = bg_glob.glob(self._metric_names, glob) self.assertEqual(metrics, found)
def __glob_names(names, glob): results = bg_glob.glob(names, glob) results.sort() return results