-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_extractor.py
31 lines (22 loc) · 1018 Bytes
/
test_extractor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
import sys
import unittest
import extractor
class MyTestExtract(unittest.TestCase):
def test_something(self):
d = extractor.load_data("https://www.lrt.lt/mediateka/video/panorama", "panorama")
self.assertEqual(d["name"], "Panorama")
def test_videos(self):
d = extractor.get_videos("https://www.lrt.lt/mediateka/video/panorama")
self.assertEqual(d[0]["genre"], "Panorama")
def test_rasytojai(self):
d = extractor.get_videos("https://www.lrt.lt/tema/dokumentiniai-filmai-rasytojai")
self.assertGreater(len(d[0]), 0)
def test_none(self):
d = extractor.load_data("https://www.lrt.lt/mediateka/video/panorama-none", "panorama")
self.assertIsNone(d)
def test_rasytojai_categorySave(self):
d = extractor.load_data("https://www.lrt.lt/tema/dokumentiniai-filmai-rasytojai", "panorama")
sys.stdout.write(extractor.to_json_string(d).decode("utf8"))
if __name__ == '__main__':
unittest.main()