Skip to content

Commit

Permalink
fixed type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Squared committed Mar 9, 2023
1 parent 30bf78e commit 6908f94
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Literal
from lxml import etree
from io import StringIO, BytesIO
from tests.constants import CAC, CBC
Expand Down Expand Up @@ -34,7 +35,14 @@ def replace_part_of_string(string, start, end, replace):
def append_to_string(string, txt):
return string + txt

def invalidate_invoice(invoice_text, choice, tag_name, attrib_name, text, index):
def invalidate_invoice(
invoice_text: str,
choice: Literal["tag", "content", "attrib"],
tag_name: str,
attrib_name: str,
text: str,
index: int
):
'''
Invalidating the given invoice by changing either the tag or the content into a new text.
Changes the index-th tag or content that matches the tag_name.
Expand Down Expand Up @@ -81,7 +89,7 @@ def invalidate_invoice(invoice_text, choice, tag_name, attrib_name, text, index)
else:
text = texts[0]

root = etree.fromstring(invoice_text.encode('utf-8'))
root = etree.fromstring(invoice_text.encode('utf-8'), parser=None)

for elem in root.getiterator():
try:
Expand Down

0 comments on commit 6908f94

Please sign in to comment.