def test_get_random_emoticon(self): if PY2: text_fixture = ['happy', u('happy'), '高兴', '\u9ad8\u5174'] else: text_fixture = [s('happy'), 'happy', s('高兴'), '高兴'] for e in text_fixture: emo = get_random_emoticon(e, emoticon_map) self.assertIsNotNone(emo)
def readDNSName(string): """ Reads a name entry in DNS format """ chars = struct.unpack_from('!B', b(string))[0] string = string[1:] name_parts = [] while chars > 0: name_parts.append(s(string[:chars])) string = string[chars:] chars = struct.unpack_from('!B',b(string))[0] string = string[1:] return (name_parts, string)
def readDNSName(string): """ Reads a name entry in DNS format """ chars = struct.unpack_from('!B', b(string))[0] string = string[1:] name_parts = [] while chars > 0: name_parts.append(s(string[:chars])) string = string[chars:] chars = struct.unpack_from('!B', b(string))[0] string = string[1:] return (name_parts, string)