This repository was archived by the owner on Oct 2, 2020. It is now read-only.
forked from lifelike/gamebookformat
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_sections.py
More file actions
executable file
·53 lines (43 loc) · 1.42 KB
/
Copy pathtest_sections.py
File metadata and controls
executable file
·53 lines (43 loc) · 1.42 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python2.7
import unittest
from unittest import TestCase
import sections
class TestSection(TestCase):
def setUp(self):
pass
def test_create(self):
sec = sections.Section("nnn", "text")
self.assertEqual(sec.name, "nnn")
self.assertEqual(sec.text, "text")
def test_add_tags(self):
sec = sections.Section("nnn", "text")
sec.add_tags(['a', 'b'])
self.assertTrue(sec.hastag('a'))
self.assertTrue(sec.hastag('b'))
sec.add_tags(['c', 'd'])
self.assertTrue(sec.hastag('a'))
self.assertTrue(sec.hastag('b'))
self.assertTrue(sec.hastag('c'))
self.assertTrue(sec.hastag('d'))
class TestBook(TestCase):
def setUp(self):
pass
def test_create(self):
b = sections.Book()
self.assertEqual(b.sections, [])
self.assertEqual(b.nr_sections, {})
self.assertEqual(b.config['max'], 0)
def test_includetag(self):
b = sections.Book(includetags=['test'])
sec = sections.Section("nnn", "text")
sec.add_tags(['some', 'test', 'other'])
b.add(sec)
self.assertEqual(b.sections, [sec])
def test_excludetag(self):
b = sections.Book(includetags=['test'])
sec = sections.Section("nnn", "text")
sec.add_tags(['some', 'other'])
b.add(sec)
self.assertEqual(b.sections, [])
if __name__ == '__main__':
unittest.main()