def test_return_variables_matching_some_regex_in_list(self): variables = self._create_variables() out_variables = variables_helper.filter_variables( variables, ['FeatureExtractor.*biases', 'StackProposalGenerator.*biases'], invert=True) self.assertItemsEqual(out_variables, [variables[1], variables[3]])
def test_return_variables_matching_empty_regex_list(self): variables = self._create_variables() out_variables = variables_helper.filter_variables(variables, [''], invert=True) self.assertItemsEqual(out_variables, [])
def test_return_variables_which_do_not_match_single_regex(self): variables = self._create_variables() out_variables = variables_helper.filter_variables( variables, ['FeatureExtractor/.*']) self.assertItemsEqual(out_variables, variables[2:])
def test_return_variables_which_do_not_match_any_regex_in_list(self): variables = self._create_variables() out_variables = variables_helper.filter_variables( variables, ['FeatureExtractor.*biases', 'StackProposalGenerator.*biases']) self.assertItemsEqual(out_variables, [variables[0], variables[2]])
def test_return_all_variables_when_empty_regex(self): variables = self._create_variables() out_variables = variables_helper.filter_variables(variables, ['']) self.assertItemsEqual(out_variables, variables)