diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2017-11-22 11:15:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-22 11:15:13 -0500 |
commit | fa9f2c3a74125ef69034a1fac905b9ded6b2ff5d (patch) | |
tree | 8a0098f37ae8f2c78b47a4676ba00f48c649759c /gerber/tests/test_layers.py | |
parent | 4bd2f6c7dac7c80fd6e530ed992e35aced2eaa71 (diff) | |
parent | 9ae238bf7ab4bc74d101605a9dbaddc098b9348d (diff) | |
download | gerbonara-fa9f2c3a74125ef69034a1fac905b9ded6b2ff5d.tar.gz gerbonara-fa9f2c3a74125ef69034a1fac905b9ded6b2ff5d.tar.bz2 gerbonara-fa9f2c3a74125ef69034a1fac905b9ded6b2ff5d.zip |
Merge pull request #76 from ju5t/guess-layer
Check gerber content for layer hints
Diffstat (limited to 'gerber/tests/test_layers.py')
-rw-r--r-- | gerber/tests/test_layers.py | 24 |
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 """ |