def test_dict_does_not_contain_key_failure_with_message(self): dict3 = { 'd': 'dvalue', 'e': 'evalue', 'f': 'fvalue', } try: Assert.does_not_contain('d', dict3, msg="failure message") except AssertionError as e: Assert.equal(e.msg, "%s should not be found in %s. failure message" % ('d', dict3))
def test_list_of_dicts_does_not_contain_dict(self): dict1 = { 'a': 'avalue', 'b': 'bvalue', 'c': 'cvalue', } dict2 = { 'a': 'dvalue', 'b': 'evalue', 'c': 'fvalue', } dict3 = { 'd': 'dvalue', 'e': 'evalue', 'f': 'fvalue', } list_of_dicts = [ dict1, dict2 ] Assert.does_not_contain(dict3, list_of_dicts)
def test_list_of_dicts_does_not_contain_dict_failure_no_message(self): dict1 = { 'a': 'avalue', 'b': 'bvalue', 'c': 'cvalue', } dict2 = { 'a': 'dvalue', 'b': 'evalue', 'c': 'fvalue', } dict3 = { 'd': 'dvalue', 'e': 'evalue', 'f': 'fvalue', } list_of_dicts = [ dict1, dict2, dict3 ] try: Assert.does_not_contain(dict3, list_of_dicts) except AssertionError as e: Assert.equal(e.msg, "%s should not be found in %s. " % (dict3, list_of_dicts))
def test_dict_does_not_contain_key(self): Assert.does_not_contain('a', { 'b': 'bvalue', 'c': 'cvalue', 'd': 'dvalue' })
def test_list_of_strings_does_not_contain_string(self): Assert.does_not_contain('turtle', ['dog', 'cat', 'guiny pig'])
def test_string_does_not_contain_letter(self): Assert.does_not_contain('a', 'bcd')