Skip to content

Commit

Permalink
Split test files
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Feb 7, 2018
1 parent 32c6c39 commit 31cb7ae
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 60 deletions.
66 changes: 66 additions & 0 deletions test/test_doc.py
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()
62 changes: 2 additions & 60 deletions test/test_interface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

"""Test the interface of the main package."""

import unittest
import tmep

Expand Down Expand Up @@ -53,67 +55,7 @@ def test_parameter_additional_functions(self):

class TestDoc(unittest.TestCase):

def setUp(self):
from tmep import doc
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',
True
)
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())


class TestDocInterface(unittest.TestCase):

def test_import(self):
import tmep
self.assertTrue(tmep.doc.Doc)


Expand Down

0 comments on commit 31cb7ae

Please sign in to comment.