Пример #1
0
 def test_item(self):
     fp = './resource/item.xml'
     item = parse_xml(ET.parse(fp).getroot())
     self.assertEqual('第一号', item.title)
     self.assertEqual('ほどほどに頑張ること。', item.sentence)
     self.assertEqual(0, len(item.children))
     self.assertEqual(INDENT + '一' + SPACE + 'ほどほどに頑張ること。', str(item))
     self.assertTrue(is_serializable(item))
Пример #2
0
 def test_chapter(self):
     fp = './resource/chapter.xml'
     chapter = parse_xml(ET.parse(fp).getroot())
     self.assertTrue(isinstance(chapter, Chapter))
     self.assertEqual('第一章 総則', chapter.title)
     self.assertEqual(0, len(chapter.children))
     self.assertEqual('第一章 総則\n', str(chapter))
     self.assertTrue(is_serializable(chapter))
Пример #3
0
 def test_paragraph(self):
     fp = './resource/paragraph.xml'
     paragraph = parse_xml(ET.parse(fp).getroot())
     self.assertTrue(isinstance(paragraph, Paragraph))
     self.assertEqual(1, paragraph.number)
     self.assertEqual('第一項', paragraph.title)
     self.assertEqual('本文ただし書', paragraph.sentence)
     self.assertEqual(0, len(paragraph.children))
     self.assertTrue(is_serializable(paragraph))
Пример #4
0
 def test_article(self):
     fp = './resource/article.xml'
     article = parse_xml(ET.parse(fp).getroot())
     self.assertTrue(isinstance(article, Article))
     self.assertEqual('(登記簿等の持出禁止)', article.caption)
     self.assertEqual('第七条の二', article.title)
     self.assertEqual('7_2', article.number)
     self.assertEqual(0, len(article.children))
     self.assertEqual('(登記簿等の持出禁止)\n第七条の二\n', str(article))
     self.assertTrue(is_serializable(article))
Пример #5
0
 def test_parse_xml(self):
     fp = './resource/law.xml'
     for node in ET.parse(fp).getroot():
         tree = parse_xml(node)
         self.assertTrue(is_serializable(tree))