def test_without_matches(self): """Test a case in which the cube passed in does not contain any attributes that partially match the expected string.""" attribute_filter = 'test' result = get_filtered_attributes(self.cube, attribute_filter=attribute_filter) self.assertFalse(result)
def test_all_matches(self): """Test a case in which the cube passed in contains attributes that all partially match the attribute_filter string.""" attribute_filter = 'mosg' result = get_filtered_attributes(self.cube, attribute_filter=attribute_filter) self.assertEqual(result, self.attributes)
def test_subset_of_matches(self): """Test a case in which the cube passed in contains some attributes that partially match the attribute_filter string, and some that do not.""" attribute_filter = "mosg__grid" expected = self.attributes expected.pop("mosg__model_configuration") result = get_filtered_attributes(self.cube, attribute_filter=attribute_filter) self.assertEqual(result, expected)
def test_no_filter(self): """Test a case in which all the attributes of the cube passed in are returned as no filter is specified.""" result = get_filtered_attributes(self.cube) self.assertEqual(result, self.cube.attributes)