-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from takuyaa/fix-recursion-error-article-range
Fix RecursionError when accessing article_range
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from ja_law_parser.model import TOC | ||
|
||
|
||
class TestTOC: | ||
def test_toc(self): | ||
xml = """\ | ||
<TOC> | ||
<TOCLabel>目次</TOCLabel> | ||
<TOCChapter Num="1"> | ||
<ChapterTitle>Chapter 1</ChapterTitle> | ||
<ArticleRange>(第一条・第二条)</ArticleRange> | ||
</TOCChapter> | ||
<TOCChapter Num="2"> | ||
<ChapterTitle>Chapter 2</ChapterTitle> | ||
<ArticleRange>(第三条―第五条)</ArticleRange> | ||
</TOCChapter> | ||
<TOCSupplProvision> | ||
<SupplProvisionLabel>附則</SupplProvisionLabel> | ||
</TOCSupplProvision> | ||
</TOC> | ||
""" | ||
toc: TOC = TOC.from_xml(xml) | ||
assert toc is not None | ||
assert toc.toc_label == "目次" | ||
assert len(toc.toc_chapters) == 2 | ||
assert toc.toc_chapters[0].num == "1" | ||
assert toc.toc_chapters[0].chapter_title.text == "Chapter 1" | ||
assert toc.toc_chapters[0].article_range.text == "(第一条・第二条)" | ||
assert toc.toc_chapters[1].num == "2" | ||
assert toc.toc_chapters[1].chapter_title.text == "Chapter 2" | ||
assert toc.toc_chapters[1].article_range.text == "(第三条―第五条)" | ||
assert toc.toc_suppl_provision.suppl_provision_label.text == "附則" |