""" unit tests for module pyreverse.visitors.xmi_uml squeleton generated by /home/syt/bin/py2tests on Jun 04 at 12:16:36 convert the class hierarchy describing the project to XMI 1.0 UML 1.3 DOM representation please notices that it is based on file generated by ArgoUML """ __revision__ = "$Id: regrtest_xmi_uml.py,v 1.8 2005/04/15 11:00:47 syt Exp $" import unittest import os os.environ['USE_DOCTYPE'] = '1' from os.path import join from xml.dom.ext import PrettyPrint from xml.parsers.xmlproc import xmlval, xmlproc, _outputters from logilab.common.astng import ASTNGManager from logilab.common.astng.inspector import Linker from pyreverse.extensions.vcgutils import VCGWriter def astng_wrapper(func, modname): return func(modname) project = ASTNGManager().project_from_files(['data'], astng_wrapper) linker = Linker(project, tag=1) linker.visit(project) from pyreverse.visitors.xmi_uml import XMIUMLVisitor class XMIUMLVisitor_ClassTest(unittest.TestCase): """ generate a dom tree conform to the XMI-1.0 UML-1.3 DTD from the project check that the generated dom is conform to the DTD """ def test_knownValues_visit(self): d = XMIUMLVisitor().visit(project, linker.id_count) path = join('generated', 'Test_project.xmi') f = open(path, 'w+') # raise str((d.doctype.systemId, d.doctype.publicId)) PrettyPrint(d, f) f.close() p = xmlval.XMLValidator() err = _outputters.MyErrorHandler(p, p.parser, warnings=1, entstack=0, rawxml=0) p.set_error_handler(err) p.set_application(xmlproc.Application()) p.parse_resource(path) self.assertEqual(err.errors, 0) self.assertEqual(err.warnings, 0) if __name__ == '__main__': unittest.main()