예제 #1
0
파일: test.py 프로젝트: VincentLoy/pytter
    def test_getters(self):
        text = 'this super tweet talk about #twitter @superplanet @frog http://duckduckgo.com'
        t = Pytter(text)

        self.assertEqual(t.get_text(), text)
        self.assertEqual(t.get_hashtags()[0].get('text'), 'twitter')
        self.assertEqual(t.get_urls()[0].get('url'), 'http://duckduckgo.com')
        self.assertEqual(t.get_users()[0].get('user'), '@superplanet')
예제 #2
0
파일: test.py 프로젝트: VincentLoy/pytter
    def test_urls(self):
        t0 = Pytter('tweet url https://github.com/VincentLoy/pytter/blob/master/pytter/pytter.py, #url')
        t1 = Pytter('tweet url https://github.com/VincentLoy/pytter/blob/master/pytter/pytter.py, '
                    + 'http://google.com #url')

        self.assertEqual(t0.urls[0].get('url'), 'https://github.com/VincentLoy/pytter/blob/master/pytter/pytter.py')
        self.assertEqual(t1.urls[0].get('url'), 'https://github.com/VincentLoy/pytter/blob/master/pytter/pytter.py')
        self.assertEqual(t1.urls[1].get('html'), HTML_URL_FORMAT.format(url='http://google.com',
                                                                        text='http://google.com',
                                                                        html_class=t1.get_html_classes().get('url')))