Added all doctests as unit tests.

parent 4f3552b4
# vim: set fileencoding=utf-8 : # vim: set fileencoding=utf-8 :
import unittest import unittest
import doctest
import graph
from node import Node, Leaf from node import Node, Leaf
from graph import generate_graph from graph import generate_graph
class TestGraph(unittest.TestCase): class TestGraph(unittest.TestCase):
def test_doctest(self):
self.assertEqual(doctest.testmod(m=graph)[0], 0)
def setUp(self): def setUp(self):
self.l0, self.l1, self.multi = Leaf(0), Leaf(1), Leaf('test') self.l0, self.l1, self.multi = Leaf(0), Leaf(1), Leaf('test')
......
import unittest import unittest
import doctest
import line
from node import Node as N, Leaf as L from node import Node as N, Leaf as L
from line import generate_line, is_id, is_int from line import generate_line, is_id, is_int
class TestLine(unittest.TestCase): class TestLine(unittest.TestCase):
def test_doctest(self):
self.assertEqual(doctest.testmod(m=line)[0], 0)
def test_empty(self): def test_empty(self):
self.assertEquals(generate_line(None), '<empty expression>') self.assertEquals(generate_line(None), '<empty expression>')
......
import unittest import unittest
import doctest
import node
from node import Node, Leaf from node import Node, Leaf
class TestNode(unittest.TestCase): class TestNode(unittest.TestCase):
def test_doctest(self):
self.assertEqual(doctest.testmod(m=node)[0], 0)
def setUp(self): def setUp(self):
self.l0 = Leaf('leaf 1') self.l0 = Leaf('leaf 1')
self.l1 = Leaf('leaf 2') self.l1 = Leaf('leaf 2')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment