changeset 72:384983d5ca1e

fix tests when running from a browser, use more standard import syntax imported from: moin--main--1.5--patch-74
author Nir Soffer <nirs@freeshell.org>
date Mon, 03 Oct 2005 22:36:36 +0000
parents a5cf73110f17
children 91e381f00248
files MoinMoin/_tests/test_converter_text_html_text_x_moin.py
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_converter_text_html_text_x_moin.py	Mon Oct 03 21:42:56 2005 +0000
+++ b/MoinMoin/_tests/test_converter_text_html_text_x_moin.py	Mon Oct 03 22:36:36 2005 +0000
@@ -1,11 +1,12 @@
 # -*- coding: utf-8 -*-
-from cStringIO import StringIO
 import unittest
-import xml.dom.DOMImplementation, xml.dom.ext
+from MoinMoin import _tests
 
-import MoinMoin.converter.text_html_text_x_moin as converter
-import MoinMoin.parser.wiki, MoinMoin.formatter.text_gedit, MoinMoin.request
-from MoinMoin import _tests
+from cStringIO import StringIO
+from MoinMoin.converter import text_html_text_x_moin as converter
+from MoinMoin.parser.wiki import Parser
+from MoinMoin.formatter.text_gedit import Formatter
+from MoinMoin.request import Clock
 
 convert = converter.convert
 error = converter.ConvertError
@@ -45,7 +46,7 @@
 
     def __init__(self, request):
         self.request = request
-        self.clock = MoinMoin.request.Clock()
+        self.clock = Clock()
         
         # This is broken - tests that need correct content_lang will fail
         self.content_lang = None
@@ -71,9 +72,9 @@
         output = output.strip('\n')
         request = MinimalRequest(self.request)
         page = MinimalPage()
-        formatter = MoinMoin.formatter.text_gedit.Formatter(request)
+        formatter = Formatter(request)
         formatter.setPage(page)
-        MoinMoin.parser.wiki.Parser(text, request).format(formatter)
+        Parser(text, request).format(formatter)
         repeat = ''.join(request.result).strip('\n')
         self.failUnlessEqual(repeat, output)
         out = self.do_convert_real([request, page.page_name, repeat])
@@ -918,9 +919,9 @@
         output = "<p>%s </p>" % output
         request = MinimalRequest(self.request)
         page = MinimalPage()
-        formatter = MoinMoin.formatter.text_gedit.Formatter(request)
+        formatter = Formatter(request)
         formatter.setPage(page)
-        MoinMoin.parser.wiki.Parser(text, request).format(formatter)
+        Parser(text, request).format(formatter)
         repeat = ''.join(request.result).strip('\n')
         self.failUnlessEqual(repeat, output)
         out = self.do_convert_real([request, page.page_name, repeat])
@@ -1029,9 +1030,9 @@
         output = "<p>%s </p>" % output
         request = MinimalRequest(self.request)
         page = MinimalPage()
-        formatter = MoinMoin.formatter.text_gedit.Formatter(request)
+        formatter = Formatter(request)
         formatter.setPage(page)
-        MoinMoin.parser.wiki.Parser(text, request).format(formatter)
+        Parser(text, request).format(formatter)
         repeat = ''.join(request.result).strip('\n')
         self.failUnlessEqual(repeat, output)
         out = self.do_convert_real([request, page.page_name, repeat])
@@ -1058,6 +1059,10 @@
         tree = converter.parse(text)
         cls().do(tree)
         out = StringIO()
+        try:
+            import xml.dom.ext
+        except ImportError:
+            raise _tests.TestSkiped('xml.dom.ext module is not available')
         xml.dom.ext.Print(tree, out)
         self.failUnlessEqual("<?xml version='1.0' encoding='UTF-8'?>%s" % output, out.getvalue().decode("utf-8"))