From 63faf4280d0655489ab0a8569c69efcd8f2e153d Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 21 Dec 2024 18:54:00 +0100 Subject: Fix failing tests --- gerbonara/excellon.py | 2 +- gerbonara/layers.py | 21 ++++++++++++++------- gerbonara/tests/test_layers.py | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gerbonara/excellon.py b/gerbonara/excellon.py index 73f9592..a2ee15f 100755 --- a/gerbonara/excellon.py +++ b/gerbonara/excellon.py @@ -783,7 +783,7 @@ class ExcellonParser(object): def do_move(self, coord_groups): x_s, x, y_s, y = coord_groups - if '.' not in x: + if (x is not None and '.' not in x) or (y is not None and '.' not in y): self.settings._file_has_fixed_width_coordinates = True if self.settings.number_format == (None, None): diff --git a/gerbonara/layers.py b/gerbonara/layers.py index 6069cdb..96c2230 100644 --- a/gerbonara/layers.py +++ b/gerbonara/layers.py @@ -583,7 +583,10 @@ class LayerStack: ambiguous = [ f'{key} ({", ".join(x.name for x in value)})' for key, value in filemap.items() - if len(value) > 1 and not 'drill' in key and not key == 'other unknown'] + if len(value) > 1 and\ + not 'drill' in key and\ + not 'excellon' in key and\ + not key == 'other unknown'] if ambiguous: raise SystemError(f'Ambiguous layer names: {", ".join(ambiguous)}') @@ -592,7 +595,10 @@ class LayerStack: netlist = None layers = {} # { tuple(key.split()): None for key in STANDARD_LAYERS } for key, paths in filemap.items(): - if len(paths) > 1 and not 'drill' in key and not key == 'other unknown': + if len(paths) > 1 and\ + not 'drill' in key and\ + not 'excellon' in key and\ + not key == 'other unknown': raise ValueError(f'Multiple matching files found for {key} layer: {", ".join(map(str, value))}') for path in paths: @@ -704,15 +710,16 @@ class LayerStack: print_layer(' Nonplated holes:', self.drill_npth) for i, l in enumerate(self._drill_layers): print_layer(f' Additional drill layer {i}:', l) - print_layer(' Board outline:', self['mechanical outline']) + + print_layer(' Board outline:', self.get('mechanical outline')) lines.append(' Soldermask:') - print_layer(' Top:', self['top mask']) - print_layer(' Bottom:', self['bottom mask']) + print_layer(' Top:', self.get('top mask')) + print_layer(' Bottom:', self.get('bottom mask')) lines.append(' Silkscreen:') - print_layer(' Top:', self['top silk']) - print_layer(' Bottom:', self['bottom silk']) + print_layer(' Top:', self.get('top silk')) + print_layer(' Bottom:', self.get('bottom silk')) lines.append(' Copper:') for (side, _use), layer in self.copper_layers: diff --git a/gerbonara/tests/test_layers.py b/gerbonara/tests/test_layers.py index b473f91..293afb2 100644 --- a/gerbonara/tests/test_layers.py +++ b/gerbonara/tests/test_layers.py @@ -46,7 +46,7 @@ REFERENCE_DIRS = { 'allegro': { '08_057494d-ipc356.ipc': 'other netlist', - '08_057494d.rou': 'mechanical outline', + '08_057494d.rou': 'drill nonplated', 'Read_Me.1': None, 'art_param.txt': None, 'assy1.art': None, -- cgit