From 6f876edd09d9b81649691e529f85653f14b8fd1c Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Tue, 22 Dec 2015 02:45:48 -0500 Subject: Add PCB interface this incorporates some of @chintal's layers.py changes PCB.from_directory() simplifies loading of multiple gerbers the PCB() class should be pretty helpful going forward... the context classes could use some cleaning up, although I'd like to wait until the freecad stuff gets merged, that way we can try to refactor the context base to support more use cases --- gerber/tests/test_layers.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 gerber/tests/test_layers.py (limited to 'gerber/tests') diff --git a/gerber/tests/test_layers.py b/gerber/tests/test_layers.py new file mode 100644 index 0000000..c77084d --- /dev/null +++ b/gerber/tests/test_layers.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +# Author: Hamilton Kibbe + +from .tests import * +from ..layers import guess_layer_class, hints + + +def test_guess_layer_class(): + """ Test layer type inferred correctly from filename + """ + + # Add any specific test cases here (filename, layer_class) + test_vectors = [(None, 'unknown'), ('NCDRILL.TXT', 'unknown'), + ('example_board.gtl', 'top'), + ('exampmle_board.sst', 'topsilk'), + ('ipc-d-356.ipc', 'ipc_netlist'),] + + for hint in hints: + for ext in hint.ext: + assert_equal(hint.layer, guess_layer_class('board.{}'.format(ext))) + for name in hint.name: + assert_equal(hint.layer, guess_layer_class('{}.pho'.format(name))) + + for filename, layer_class in test_vectors: + assert_equal(layer_class, guess_layer_class(filename)) + + +def test_sort_layers(): + """ Test layer ordering + """ + pass -- cgit