summaryrefslogtreecommitdiff
path: root/gerber/tests/test_layers.py
diff options
context:
space:
mode:
authorju5t <m@ju5t.nl>2017-11-01 16:23:22 +0100
committerju5t <m@ju5t.nl>2017-11-01 16:23:22 +0100
commit9ae238bf7ab4bc74d101605a9dbaddc098b9348d (patch)
tree51248e38ea07e01bea1e7b26fd941193fc08e016 /gerber/tests/test_layers.py
parent8301011abd5961ab6edb2bf91e61d82658df6b9a (diff)
downloadgerbonara-9ae238bf7ab4bc74d101605a9dbaddc098b9348d.tar.gz
gerbonara-9ae238bf7ab4bc74d101605a9dbaddc098b9348d.tar.bz2
gerbonara-9ae238bf7ab4bc74d101605a9dbaddc098b9348d.zip
Check gerber content for layer hints
Diffstat (limited to 'gerber/tests/test_layers.py')
-rw-r--r--gerber/tests/test_layers.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/gerber/tests/test_layers.py b/gerber/tests/test_layers.py
index 6cafecf..597c0d3 100644
--- a/gerber/tests/test_layers.py
+++ b/gerber/tests/test_layers.py
@@ -61,7 +61,8 @@ def test_guess_layer_class_regex():
Hint(layer='top',
ext=[],
name=[],
- regex=r'(.*)(\scopper top|\stop copper)$'
+ regex=r'(.*)(\scopper top|\stop copper)$',
+ content=[]
),
]
hints.extend(layer_hints)
@@ -70,6 +71,27 @@ def test_guess_layer_class_regex():
assert_equal(layer_class, guess_layer_class(filename))
+def test_guess_layer_class_by_content():
+ """ Test layer class by checking content
+ """
+
+ expected_layer_class = 'bottom'
+ filename = os.path.join(os.path.dirname(__file__),
+ 'resources/example_guess_by_content.g0')
+
+ layer_hints = [
+ Hint(layer='bottom',
+ ext=[],
+ name=[],
+ regex='',
+ content=['G04 Layer name: Bottom']
+ )
+ ]
+ hints.extend(layer_hints)
+
+ assert_equal(expected_layer_class, guess_layer_class_by_content(filename))
+
+
def test_sort_layers():
""" Test layer ordering
"""