Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(165448)

Delta Between Two Patch Sets: Lib/test/test_sax.py

Issue 16510: Using appropriate checks in tests
Left Patch Set: Created 6 years, 3 months ago
Right Patch Set: Created 5 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_richcmp.py ('k') | Lib/test/test_selectors.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 # regression test for SAX 2.0 1 # regression test for SAX 2.0
2 # $Id$ 2 # $Id$
3 3
4 from xml.sax import make_parser, ContentHandler, \ 4 from xml.sax import make_parser, ContentHandler, \
5 SAXException, SAXReaderNotAvailable, SAXParseException 5 SAXException, SAXReaderNotAvailable, SAXParseException
6 import unittest 6 import unittest
7 try: 7 try:
8 make_parser() 8 make_parser()
9 except SAXReaderNotAvailable: 9 except SAXReaderNotAvailable:
10 # don't try to test this module if we cannot create a parser 10 # don't try to test this module if we cannot create a parser
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 gather = self.AttrGatherer() 747 gather = self.AttrGatherer()
748 parser.setContentHandler(gather) 748 parser.setContentHandler(gather)
749 749
750 parser.feed("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri) 750 parser.feed("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri)
751 parser.close() 751 parser.close()
752 752
753 attrs = gather._attrs 753 attrs = gather._attrs
754 754
755 self.assertEqual(attrs.getLength(), 1) 755 self.assertEqual(attrs.getLength(), 1)
756 self.assertEqual(attrs.getNames(), [(ns_uri, "attr")]) 756 self.assertEqual(attrs.getNames(), [(ns_uri, "attr")])
757 self.assertTrue((attrs.getQNames() == [] or 757 self.assertIn(attrs.getQNames(), ([], ["ns:attr"]))
758 attrs.getQNames() == ["ns:attr"]))
759 self.assertEqual(len(attrs), 1) 758 self.assertEqual(len(attrs), 1)
760 self.assertIn((ns_uri, "attr"), attrs) 759 self.assertIn((ns_uri, "attr"), attrs)
761 self.assertEqual(attrs.get((ns_uri, "attr")), "val") 760 self.assertEqual(attrs.get((ns_uri, "attr")), "val")
762 self.assertEqual(attrs.get((ns_uri, "attr"), 25), "val") 761 self.assertEqual(attrs.get((ns_uri, "attr"), 25), "val")
763 self.assertEqual(list(attrs.items()), [((ns_uri, "attr"), "val")]) 762 self.assertEqual(list(attrs.items()), [((ns_uri, "attr"), "val")])
764 self.assertEqual(list(attrs.values()), ["val"]) 763 self.assertEqual(list(attrs.values()), ["val"])
765 self.assertEqual(attrs.getValue((ns_uri, "attr")), "val") 764 self.assertEqual(attrs.getValue((ns_uri, "attr")), "val")
766 self.assertEqual(attrs[(ns_uri, "attr")], "val") 765 self.assertEqual(attrs[(ns_uri, "attr")], "val")
767 766
768 # ===== InputSource support 767 # ===== InputSource support
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 BytesXmlgenTest, 997 BytesXmlgenTest,
999 WriterXmlgenTest, 998 WriterXmlgenTest,
1000 StreamWriterXmlgenTest, 999 StreamWriterXmlgenTest,
1001 StreamReaderWriterXmlgenTest, 1000 StreamReaderWriterXmlgenTest,
1002 ExpatReaderTest, 1001 ExpatReaderTest,
1003 ErrorReportingTest, 1002 ErrorReportingTest,
1004 XmlReaderTest) 1003 XmlReaderTest)
1005 1004
1006 if __name__ == "__main__": 1005 if __name__ == "__main__":
1007 test_main() 1006 test_main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+