-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32c6c39
commit 31cb7ae
Showing
2 changed files
with
68 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
# -*- coding: utf-8 -*- | ||
|
||
import unittest | ||
from tmep import doc | ||
|
||
|
||
class TestDoc(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.doc = doc.Doc() | ||
|
||
def test_attribute_functions(self): | ||
self.assertTrue(self.doc.functions) | ||
self.assertTrue(isinstance(self.doc.functions, list)) | ||
|
||
def test_attribute_synopsises(self): | ||
self.assertTrue(self.doc.synopsises) | ||
self.assertTrue(isinstance(self.doc.synopsises, dict)) | ||
|
||
def test_attribute_examples(self): | ||
self.assertTrue(self.doc.examples) | ||
self.assertTrue(isinstance(self.doc.examples, dict)) | ||
|
||
def test_attribute_descriptions(self): | ||
self.assertTrue(self.doc.descriptions) | ||
self.assertTrue(isinstance(self.doc.descriptions, dict)) | ||
|
||
def test_functions_sort(self): | ||
self.assertEqual(self.doc.functions, sorted(self.doc.functions)) | ||
|
||
def test_extract_synopsis(self): | ||
value = self.doc.extract_value( | ||
' * synopsis: ``%shorten(text, max_size)``', | ||
'synopsis' | ||
) | ||
self.assertEqual(value, '%shorten(text, max_size)') | ||
|
||
def test_extract_synopsis_multiple(self): | ||
value = self.doc.extract_value( | ||
'* synopsis: ``%shorten(text)`` or ``%shorten(text, max_size)``', | ||
'synopsis' | ||
) | ||
self.assertEqual(value, '%shorten(text) or %shorten(text, max_size)') | ||
|
||
def test_extract_example(self): | ||
value = self.doc.extract_value( | ||
' * example: ``%shorten($title, 2)``', | ||
'example', | ||
) | ||
self.assertEqual(value, '%shorten($title, 2)') | ||
|
||
def test_extract_description(self): | ||
value = self.doc.extract_value( | ||
' * description: Some description', | ||
'description', | ||
False | ||
) | ||
self.assertEqual(value, 'Some description') | ||
|
||
def test_get(self): | ||
self.assertTrue(self.doc.get()) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters