blob: 1c0be00af5a898f74cc7b1b0ad6f5943c1bb1355 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--- tests/testxmlgen.py
+++ tests/testxmlgen.py
@@ -20,6 +20,7 @@
import xml.sax, xml.sax.saxutils
import StringIO
+import sys
import unittest
class MyGen(xml.sax.saxutils.XMLGenerator):
@@ -70,14 +71,16 @@
<a:greetings xmlns:a="http://example.com/ns">
<a:greet xml:lang="en">Hello world</a:greet>
</a:greetings>"""
- parser.feed(testcontent)
- parser.close()
- expectedresult="""<?xml version="1.0" encoding="utf-8"?>
+ if sys.version_info < (2, 7):
+ self.assertRaises(KeyError, parser.feed, testcontent)
+ else:
+ parser.feed(testcontent)
+ parser.close()
+ expectedresult="""<?xml version="1.0" encoding="utf-8"?>
<a:greetings xmlns:a="http://example.com/ns">
<a:greet xml:lang="en">Hello world</a:greet>
</a:greetings>"""
- self.assertEqual( outfp.getvalue(), expectedresult)
-# self.assertRaises(KeyError, parser.feed, testcontent)
+ self.assertEqual( outfp.getvalue(), expectedresult)
def test_myxml(self):
""" Test that my patch works """
|