Skip to content

Commit

Permalink
Fix erroneous commit
Browse files Browse the repository at this point in the history
The -1 change was not correctly released.
  • Loading branch information
longhotsummer committed Sep 25, 2020
1 parent ecde314 commit b757bc4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ Cobalt is Copyright 2015-2020 AfricanLII.
Change Log
----------

4.0.1
4.0.2
.....

- Better error handling when parsing malformed XML.

4.0.1
.....

(replaced by 4.0.2)

4.0.0
.....

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.1
4.0.2
2 changes: 1 addition & 1 deletion cobalt/akn.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def parse(self, xml, document_type=None):
if root.countchildren() < 1:
raise ValueError("XML root element must have at least one child")

name = root.getchildren()[0].tag.split('}', 1)[1]
name = root.getchildren()[0].tag.split('}', 1)[-1]
if name != self.document_type:
raise ValueError(f"Expected {self.document_type} as first child of root element, but got {name} instead")

Expand Down
5 changes: 4 additions & 1 deletion tests/test_structured_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,10 @@ def test_bad_xml(self):
Act('<root>no namespace</root>')

with self.assertRaises(ValueError):
Act('<akomaNtoso>no namespace</akomaNtoso>')
Act('<akomaNtoso>no first child</akomaNtoso>')

with self.assertRaises(ValueError):
Act('<akomaNtoso><child>no namespace</child></akomaNtoso>')


class JudgmentTestCase(TestCase):
Expand Down

0 comments on commit b757bc4

Please sign in to comment.