summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/tests
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-01-24 11:55:19 +0100
committerjaseg <git@jaseg.de>2022-01-24 11:55:19 +0100
commit4a6d76c557caf7263ab57e5fe840d28aa3356621 (patch)
tree98d9cd7f87cbedad58521c1fbbbc5dce649598eb /gerbonara/gerber/tests
parent269087bead401513cfadc0d912bfad2b6ec8b9c6 (diff)
downloadgerbonara-4a6d76c557caf7263ab57e5fe840d28aa3356621.tar.gz
gerbonara-4a6d76c557caf7263ab57e5fe840d28aa3356621.tar.bz2
gerbonara-4a6d76c557caf7263ab57e5fe840d28aa3356621.zip
Improve error messages
Diffstat (limited to 'gerbonara/gerber/tests')
-rw-r--r--gerbonara/gerber/tests/test_excellon.py8
-rw-r--r--gerbonara/gerber/tests/test_rs274x.py9
2 files changed, 17 insertions, 0 deletions
diff --git a/gerbonara/gerber/tests/test_excellon.py b/gerbonara/gerber/tests/test_excellon.py
index fb0ebb8..fb25d8f 100644
--- a/gerbonara/gerber/tests/test_excellon.py
+++ b/gerbonara/gerber/tests/test_excellon.py
@@ -94,4 +94,12 @@ def test_gerber_alignment(reference, tmpfile, print_on_error):
assert matches > 10
assert matches/total > 0.5
+@filter_syntax_warnings
+def test_syntax_error():
+ ref = reference_path('test_syntax_error.exc')
+ with pytest.raises(SyntaxError) as exc_info:
+ ExcellonFile.open(ref)
+
+ assert 'test_syntax_error.exc' in exc_info.value.msg
+ assert '12' in exc_info.value.msg # lineno
diff --git a/gerbonara/gerber/tests/test_rs274x.py b/gerbonara/gerber/tests/test_rs274x.py
index 7e21d62..83148a5 100644
--- a/gerbonara/gerber/tests/test_rs274x.py
+++ b/gerbonara/gerber/tests/test_rs274x.py
@@ -501,3 +501,12 @@ def test_bounding_box(reference, tmpfile):
assert margin_px-2 <= row_prefix <= margin_px+2
assert margin_px-2 <= row_suffix <= margin_px+2
+@filter_syntax_warnings
+def test_syntax_error():
+ ref = reference_path('test_syntax_error.gbr')
+ with pytest.raises(SyntaxError) as exc_info:
+ GerberFile.open(ref)
+
+ assert 'test_syntax_error.gbr' in exc_info.value.msg
+ assert '7' in exc_info.value.msg # lineno
+