tangled
alpha
login
or
join now
dekker.one
/
Fourmi
0
fork
atom
A web scraper build to search specific information for a given compound (and its pseudonyms)
0
fork
atom
overview
issues
pulls
pipelines
Added tests for the source loader
dekker.one
11 years ago
c3d2bf92
7a8c0fe6
+30
-1
1 changed file
expand all
collapse all
unified
split
tests
test_sourceloader.py
+30
-1
tests/test_sourceloader.py
···
1
1
import unittest
2
2
+
from sourceloader import SourceLoader
3
3
+
2
4
3
5
4
6
class TestSourceloader(unittest.TestCase):
5
5
-
pass
7
7
+
8
8
+
def setUp(self):
9
9
+
self.loader = SourceLoader()
10
10
+
11
11
+
def test_init(self):
12
12
+
# Test if sourceloader points to the right directory, where the sources are present.
13
13
+
self.assertIn("Source: Source", str(self.loader))
14
14
+
self.assertIn("Source: NIST", str(self.loader))
15
15
+
self.assertIn("Source: ChemSpider", str(self.loader))
16
16
+
self.assertIn("Source: WikipediaParser", str(self.loader))
17
17
+
18
18
+
def test_include(self):
19
19
+
#Tests for the include functionality.
20
20
+
self.loader.include(["So.rc.*"])
21
21
+
22
22
+
self.assertIn("Source: Source", str(self.loader))
23
23
+
self.assertNotIn("Source: NIST", str(self.loader))
24
24
+
self.assertNotIn("Source: ChemSpider", str(self.loader))
25
25
+
self.assertNotIn("Source: WikipediaParser", str(self.loader))
26
26
+
27
27
+
def test_exclude(self):
28
28
+
#Tests for the exclude functionality.
29
29
+
self.loader.exclude(["So.rc.*"])
30
30
+
31
31
+
self.assertNotIn("Source: Source", str(self.loader))
32
32
+
self.assertIn("Source: NIST", str(self.loader))
33
33
+
self.assertIn("Source: ChemSpider", str(self.loader))
34
34
+
self.assertIn("Source: WikipediaParser", str(self.loader))