diff options
author | ju5t <m@ju5t.nl> | 2016-12-01 21:08:17 +0100 |
---|---|---|
committer | ju5t <m@ju5t.nl> | 2016-12-01 21:08:17 +0100 |
commit | ffeaf788f090b10307247775b43dd7c0b0fd7342 (patch) | |
tree | 895d64d4e3ff260612e642651a26c2ce10b32e55 /gerber/tests | |
parent | c15033a7834b825999e9da5ef4a5135cfb125b25 (diff) | |
download | gerbonara-ffeaf788f090b10307247775b43dd7c0b0fd7342.tar.gz gerbonara-ffeaf788f090b10307247775b43dd7c0b0fd7342.tar.bz2 gerbonara-ffeaf788f090b10307247775b43dd7c0b0fd7342.zip |
(#61) Add regex option to discover layer classes
Diffstat (limited to 'gerber/tests')
-rw-r--r-- | gerber/tests/test_layers.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gerber/tests/test_layers.py b/gerber/tests/test_layers.py index 7e36dc2..6cafecf 100644 --- a/gerber/tests/test_layers.py +++ b/gerber/tests/test_layers.py @@ -48,6 +48,27 @@ def test_guess_layer_class(): for filename, layer_class in test_vectors: assert_equal(layer_class, guess_layer_class(filename)) +def test_guess_layer_class_regex(): + """ Test regular expressions for layer matching + """ + + # Add any specific test case (filename, layer_class) + test_vectors = [('test - top copper.gbr', 'top'), + ('test - copper top.gbr', 'top'), ] + + # Add custom regular expressions + layer_hints = [ + Hint(layer='top', + ext=[], + name=[], + regex=r'(.*)(\scopper top|\stop copper)$' + ), + ] + hints.extend(layer_hints) + + for filename, layer_class in test_vectors: + assert_equal(layer_class, guess_layer_class(filename)) + def test_sort_layers(): """ Test layer ordering |