def files_which_match_some_of_regexp_but_not_the_end_shouldnt_match(): """ Because we're using re.match the regular expression has to match the start - but not necassarily the end. This test ensures that we have taken care of that as often the extension is the most important part. """ import cis.plugin as plugin from cis.data_io.products.AProduct import AProduct # We have to patch all of the plugin classes because get_file_type_error gets called and this file doesn't exist # we are only testing the wildcard matching logic. product_classes = plugin.find_plugin_classes(AProduct, 'cis.data_io.products') for p in product_classes: p.get_file_type_error = lambda self, f: None _ = __get_class(example_caliop_l2_filename + ".ext")
def check_regex_matching(cls_name, filename): from cis.data_io.products.AProduct import __get_class cls = __get_class(filename) eq_(cls.__name__, cls_name)
def can_overide_default_product(): from cis.data_io.products.gridded_NetCDF import NetCDF_Gridded eq_(__get_class(example_caliop_l2_filename), Caliop_L2) eq_(__get_class(example_caliop_l2_filename, "NetCDF_Gridded"), NetCDF_Gridded)