def test_has_classifications_empty(self): """ Test that has_classifications returns false when the internal map has either not been set or is an empty dictionary. """ e = MemoryClassificationElement('test', 0) e._c = None assert e.has_classifications() is False e._c = {} assert e.has_classifications() is False
def test_get_config_nonempty(self): """ Test that configuration returned is empty. """ e = MemoryClassificationElement('test', 0) e._c = {'a': 1.0, 'b': 0.0} assert e.get_config() == {}
def test_has_classification_nonempty(self): """ Test that has_classifications returns true when there is a valid internal map. """ e = MemoryClassificationElement('test', 0) e._c = {'a': 1, 'b': 0} assert e.has_classifications() is True
def test_get_classification(self): """ Test that a valid classification map is returned from """ expected_map = {'a': 1, 'b': 0} e = MemoryClassificationElement('test', 0) e._c = expected_map assert e.get_classification() == expected_map
def test_get_classification_empty(self): """ Test that NoClassificationError is raised when there is no or an empty classification map set. """ e = MemoryClassificationElement('test', 0) e._c = None with pytest.raises(NoClassificationError, match="No classification labels/values"): e.get_classification()