Exemplo n.º 1
0
 def test_sanitize_username(self):
     dirty_and_clean = [
         ('@dialelo', 'dialelo'),
         ('dialelo', 'dialelo'),
         ('?@mental_floss', 'mental_floss'),
         ('@4n_4Wfu1_US3RN4M3', '4n_4Wfu1_US3RN4M3'),
     ]
     for dirty, clean in dirty_and_clean:
         sanitized = sanitize_username(dirty)
         self.assertEqual(sanitized, clean)
Exemplo n.º 2
0
 def test_sanitize_username(self):
     dirty_and_clean = [
         ('@dialelo',           'dialelo'),
         ('dialelo',            'dialelo'),
         ('?@mental_floss',     'mental_floss'),
         ('@4n_4Wfu1_US3RN4M3', '4n_4Wfu1_US3RN4M3'),
     ]
     for dirty, clean in dirty_and_clean:
         sanitized = sanitize_username(dirty)
         self.assertEqual(sanitized, clean)
Exemplo n.º 3
0
 def mentioned_usernames(self):
     """
     Return mentioned usernames in `status` without '@'.
     """
     # TODO: use self.entities if available
     usernames = []
     for word in self.text.split():
         if len(word) > 1 and word.startswith("@"):
             word.strip("@")
             usernames.append(sanitize_username(word))
     return list(set(usernames))
Exemplo n.º 4
0
 def mentioned_usernames(self):
     """
     Return mentioned usernames in `status` without '@'.
     """
     # TODO: use self.entities if available
     usernames = []
     for word in self.text.split():
         if len(word) > 1 and word.startswith('@'):
             word.strip('@')
             usernames.append(sanitize_username(word))
     return list(set(usernames))