-
-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathtest_cache.py
26 lines (19 loc) · 897 Bytes
/
test_cache.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
import unittest
from ..lib.cache import Paragraph
class TestParagraph(unittest.TestCase):
def setUp(self):
self.paragraph = Paragraph(
1, 'TEST', 'a\n\nb\n\nc', 'a\n\nb\n\nc\n\n',
translation='A\n\nB\n\nC', attributes='{"class": "test"}')
def test_created_paragraph(self):
self.assertIsInstance(self.paragraph, Paragraph)
self.assertFalse(self.paragraph.is_cache)
self.assertIsNone(self.paragraph.error)
self.assertTrue(self.paragraph.aligned)
def test_get_attributes(self):
self.assertEqual({'class': 'test'}, self.paragraph.get_attributes())
def test_check_translation(self):
self.assertTrue(self.paragraph.is_alignment('\n\n'))
self.paragraph.original = 'a\n\nb\n\nc'
self.paragraph.translation = 'A\n\nB\nC\n\n'
self.assertFalse(self.paragraph.is_alignment('\n\n'))