def test_no_empties(): """No empties should return the same list without empty elements.""" starting = ["something", "", "else", None, "and", "things", "", r""] emptyless = formatting.no_empties(starting) assert emptyless == ["something", "else", "and", "things"]
def test_no_empties(): """No empties should return the same list without empty elements.""" starting = ["something", "", "else", None, "and", "things", "", r""] emptyless = formatting.no_empties(starting) assert emptyless == ["something", "else", "and", "things"]
def test_no_empties(self): """No empties should return the same list without empty elements.""" starting = ["something", "", "else", None, "and", "things", "", r""] self.assertEqual( formatting.no_empties(starting), ["something", "else", "and", "things"], )
def test_no_empties_encodings(fake_unicode_encode_error): """All of DEFAULT_ENCODINGS should be tried on items in the input list.""" decode_patch = patch.object( formatting.codecs, "encode", side_effect=fake_unicode_encode_error, ) with decode_patch as patched_encode: assert formatting.no_empties(["something"]) == [] assert_all_encodings("something", patched_encode)
def test_no_empties_encodings(fake_unicode_encode_error): """All of DEFAULT_ENCODINGS should be tried on items in the input list.""" decode_patch = patch.object( formatting.codecs, "encode", side_effect=fake_unicode_encode_error, ) with decode_patch as patched_encode: assert formatting.no_empties(["something"]) == [] assert_all_encodings("something", patched_encode)