def test_max_invalid_param_count(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.max( {}, False, ["1", "2"], YAMLPath("/") )) assert -1 < str(ex.value).find("Invalid parameter count to ")
def test_max_missing_aoh_param(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.max( [{'a': 1},{'a': 2}], False, [], YAMLPath("/") )) assert -1 < str(ex.value).find("when evaluating an Array-of-Hashes")
def test_parent_invalid_step_count(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.parent( {}, False, ["5"], YAMLPath("/") )) assert -1 < str(ex.value).find("higher than the document root")
def test_has_child_invalid_node(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.has_child( "abc: xyz", False, ["wwk"], YAMLPath("") )) assert -1 < str(ex.value).find("has no child nodes")
def test_parent_invalid_parameter(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.parent( {}, False, ["abc"], YAMLPath("/") )) assert -1 < str(ex.value).find("Invalid parameter passed to ")
def test_parent_invalid_inversion(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.parent( {}, True, [], YAMLPath("/") )) assert -1 < str(ex.value).find("Inversion is meaningless to ")
def test_min_incorrect_node(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.min( {'b': 2}, False, ['b'], YAMLPath("/*[max(b)]") )) assert -1 < str(ex.value).find("operates against collections of data")
def test_min_invalid_array_param(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.min( [1, 2, 3], False, ['3'], YAMLPath("/") )) assert -1 < str(ex.value).find("when comparing Array/sequence/list elements to one another")
def test_min_missing_hash_param(self): with pytest.raises(YAMLPathException) as ex: nodes = list(KeywordSearches.min( {'a': {'b': 1}, 'c': {'d': 2}}, False, [], YAMLPath("/") )) assert -1 < str(ex.value).find("when comparing Hash/map/dict children")