Source

qadpid / tests / test_dot_writer.py

Full commit
"""
DOT writer tests

Copyright 2011 John Chandler
This software is distributed under the terms of the GNU General Public License version 3
"""

import unittest
from StringIO import StringIO

from qadpid.writer import DOTWriter


class TestDOTWriter( unittest.TestCase ):
    """ Tests for DOT writer """
    def test_minimal_file( self ):
        """ Tests output when no hierarchy """
        output_file = StringIO()
        writer      = DOTWriter("")
        
        writer.write(output_file)
        output_file.seek(0)  # rewind to the beginning

        self.assertEquals( output_file.readline(), "digraph code_hierarchy {\n" )
        self.assertEquals( output_file.readline(), "}\n" )


if __name__ == "__main__":
    unittest.main()