diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2016-12-03 18:27:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-03 18:27:36 -0500 |
commit | 1c0005437eb70d52c51579d0d8bafb1ca46c93a5 (patch) | |
tree | 8fa3387cd2e2c80683b1c9b21adbca383259c948 /gerber/tests | |
parent | 467bcdbc2a404b4b79adf6c092c8aed7eac8b9b5 (diff) | |
parent | d6a815225bd5d213b2fd629c1d927fca2cacd8c3 (diff) | |
download | gerbonara-1c0005437eb70d52c51579d0d8bafb1ca46c93a5.tar.gz gerbonara-1c0005437eb70d52c51579d0d8bafb1ca46c93a5.tar.bz2 gerbonara-1c0005437eb70d52c51579d0d8bafb1ca46c93a5.zip |
Merge pull request #62 from ju5t/develop
(#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 |