-
Notifications
You must be signed in to change notification settings - Fork 0
/
releases_unit_test.py
33 lines (26 loc) · 1.04 KB
/
releases_unit_test.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
32
33
import unittest
from releases import ReleaseScraper
class ReleaseScraperTest(unittest.TestCase):
def test_conceptdoi_is_none(self):
conceptdoi = None
self.scraper = ReleaseScraper(conceptdoi)
actual_message = self.scraper.message
expected_message = "record has no doi value of any kind."
self.assertEqual(expected_message, actual_message)
def test_conceptdoi_is_not_a_string(self):
conceptdoi = {
"a": 4,
"b": "the_string"
}
self.scraper = ReleaseScraper(conceptdoi)
actual_message = self.scraper.message
expected_message = "doi should be a string."
self.assertEqual(expected_message, actual_message)
def test_conceptdoi_is_empty_string(self):
conceptdoi = ""
self.scraper = ReleaseScraper(conceptdoi)
actual_message = self.scraper.message
expected_message = "doi should not be an empty string."
self.assertEqual(expected_message, actual_message)
if __name__ == '__main__':
unittest.main()