Skip to content

Commit f17fd5f

Browse files
committed
fix string in test
1 parent 281063b commit f17fd5f

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- BREAKING CHANGE: Segment() calls *must* provide the tag name now as the first parameter.
1414
- change plugin system from `metaclass` to `__init_subclass__`
1515
- raise ValidationError, not AssertionError, when ServiceAdviceString is not 6 chars long
16+
- Drop support for Python versions < 3.10 (3.8 was EOL 2024-10-07, 3.9 not much used in Distros.)
17+
1618
### ADDED
1719
- massively improve type annotations (thanks Tammo Ippen)
1820
- use code-based structures to validate segments and data elements

tests/test_parser.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,13 @@ def test_edifact_text_with_newlines():
287287
assert len(segments) == 12
288288
segments = list(Parser().parse("UNA:+,? '" + example_text))
289289
assert len(segments) == 13
290+
291+
292+
def test_edifact_text_with_newline_at_end():
293+
example_text = """UNB+IBMA:1+FACHARZT A+PRAKTIKER X+950402+1200+1'
294+
UNH+000001+MEDRPT:1:901:UN'
295+
UNT+7+000001'
296+
UNZ+2+1'
297+
"""
298+
segments = list(Parser().parse(example_text))
299+
assert len(segments) == 4

tests/test_tokenizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,12 @@ def test_escaped_newline_char():
192192
)
193193
)
194194
assert "Newlines after escape characters are not allowed." in str(excinfo.value)
195+
assert "line 0, column 5" in str(excinfo.value)
195196

196197
# a "\n" must do the same as a real newline
197198
with pytest.raises(EdifactSyntaxError) as excinfo:
198199
# must raise a EdifactSyntaxError as there is no newline after an escape char
199200
# "?" allowed.
200201
list(Tokenizer().get_tokens("UNB+?\nFOO'"))
201202
assert "Newlines after escape characters are not allowed." in str(excinfo.value)
202-
assert "Unexpected end of EDI messages." in str(excinfo.value)
203+
assert "line 0, column 5" in str(excinfo.value)

0 commit comments

Comments
 (0)