'Test remove_handle() from casual.py with specially crafted edge cases'

def test_remove_handle(self):

    tokenizer = TweetTokenizer(strip_handles=True)
    test1 = u'@twitter    hello    @twi_tter_.    hi    @12345    @123news'
    expected = [u'hello', u'.', u'hi']
    result = tokenizer.tokenize(test1)
    self.assertEqual(result, expected)
    test2 = u'@n`@n~@n(@n)@n-@n=@n+@n\\@n|@n[@n]@n{@n}@n;@n:@n\'@n"@n/@n?@n.@n,@n<@n>@n    @n\n@n    \xf1@n.\xfc@n.\xe7@n.'
    expected = [u'`', u'~', u'(', u')', u'-', u'=', u'+', u'\\', u'|', u'[', u']', u'{', u'}', u';', u':', u"'", u'"', u'/', u'?', u'.', u',', u'<', u'>', u'\xf1', u'.', u'\xfc', u'.', u'\xe7', u'.']
    result = tokenizer.tokenize(test2)
    self.assertEqual(result, expected)
    test3 = u'a@n    j@n    z@n    A@n    L@n    Z@n    1@n    4@n    7@n    9@n    0@n    _@n    !@n    @@n    #@n    $@n    %@n    &@n    *@n'
    expected = [u'a', u'@n', u'j', u'@n', u'z', u'@n', u'A', u'@n', u'L', u'@n', u'Z', u'@n', u'1', u'@n', u'4', u'@n', u'7', u'@n', u'9', u'@n', u'0', u'@n', u'_', u'@n', u'!', u'@n', u'@', u'@n', u'#', u'@n', u'$', u'@n', u'%', u'@n', u'&', u'@n', u'*', u'@n']
    result = tokenizer.tokenize(test3)
    self.assertEqual(result, expected)
    test4 = u'@n!a    @n#a    @n$a    @n%a    @n&a    @n*a'
    expected = [u'!', u'a', u'#', u'a', u'$', u'a', u'%', u'a', u'&', u'a', u'*', u'a']
    result = tokenizer.tokenize(test4)
    self.assertEqual(result, expected)
    test5 = u'@n!@n    @n#@n    @n$@n    @n%@n    @n&@n    @n*@n    @n@n    @@n    @n@@n    @n_@n    @n7@n    @nj@n'
    expected = [u'!', u'@n', u'#', u'@n', u'$', u'@n', u'%', u'@n', u'&', u'@n', u'*', u'@n', u'@n', u'@n', u'@', u'@n', u'@n', u'@', u'@n', u'@n_', u'@n', u'@n7', u'@n', u'@nj', u'@n']
    result = tokenizer.tokenize(test5)
    self.assertEqual(result, expected)
    test6 = u'@abcdefghijklmnopqrstuvwxyz    @abcdefghijklmnopqrst1234    @abcdefghijklmnopqrst_    @abcdefghijklmnopqrstendofhandle'
    expected = [u'uvwxyz', u'1234', u'_', u'endofhandle']
    result = tokenizer.tokenize(test6)
    self.assertEqual(result, expected)
    test7 = u'@abcdefghijklmnopqrstu@abcde    @abcdefghijklmnopqrst@abcde    @abcdefghijklmnopqrst_@abcde    @abcdefghijklmnopqrst5@abcde'
    expected = [u'u', u'@abcde', u'@abcdefghijklmnopqrst', u'@abcde', u'_', u'@abcde', u'5', u'@abcde']
    result = tokenizer.tokenize(test7)
    self.assertEqual(result, expected)
