From 4565712869ef4269d62de593a245ca8d001c4ea9 Mon Sep 17 00:00:00 2001 From: jaseg Date: Thu, 7 Oct 2021 11:13:12 +0200 Subject: WIP --- gerbonara/gerber/tests/panelize/test_dxf.py | 2 ++ gerbonara/gerber/tests/panelize/test_rs274x.py | 23 ++++++++++++++++------- gerbonara/gerber/tests/panelize/test_utility.py | 15 --------------- 3 files changed, 18 insertions(+), 22 deletions(-) (limited to 'gerbonara/gerber/tests/panelize') diff --git a/gerbonara/gerber/tests/panelize/test_dxf.py b/gerbonara/gerber/tests/panelize/test_dxf.py index dfd59d2..39c3842 100644 --- a/gerbonara/gerber/tests/panelize/test_dxf.py +++ b/gerbonara/gerber/tests/panelize/test_dxf.py @@ -8,10 +8,12 @@ import tempfile from pathlib import Path from contextlib import contextmanager import unittest + from ... import panelize from ...utils import inch, metric +@unittest.skip class TestExcellon(unittest.TestCase): @classmethod def setUpClass(cls): diff --git a/gerbonara/gerber/tests/panelize/test_rs274x.py b/gerbonara/gerber/tests/panelize/test_rs274x.py index 85748a3..067717d 100644 --- a/gerbonara/gerber/tests/panelize/test_rs274x.py +++ b/gerbonara/gerber/tests/panelize/test_rs274x.py @@ -8,7 +8,7 @@ import tempfile from pathlib import Path from contextlib import contextmanager import unittest -from ... import panelize +from ...rs274x import read class TestRs274x(unittest.TestCase): @classmethod @@ -26,41 +26,50 @@ class TestRs274x(unittest.TestCase): actual = tmp_out.read() expected = (self.EXPECTSDIR / reference_fn).read_bytes() + + print('==== ACTUAL ===') + print(actual.decode()) + print() + print() + print('==== EXPECTED ===') + print(expected.decode()) + print() + print() self.assertEqual(actual, expected) def test_save(self): with self._check_result('RS2724x_save.gtl') as outfile: - gerber = panelize.read(self.METRIC_FILE) + gerber = read(self.METRIC_FILE) gerber.write(outfile) def test_to_inch(self): with self._check_result('RS2724x_to_inch.gtl') as outfile: - gerber = panelize.read(self.METRIC_FILE) + gerber = read(self.METRIC_FILE) gerber.to_inch() gerber.format = (2,5) gerber.write(outfile) def test_to_metric(self): with self._check_result('RS2724x_to_metric.gtl') as outfile: - gerber = panelize.read(self.INCH_FILE) + gerber = read(self.INCH_FILE) gerber.to_metric() gerber.format = (3, 4) gerber.write(outfile) def test_offset(self): with self._check_result('RS2724x_offset.gtl') as outfile: - gerber = panelize.read(self.METRIC_FILE) + gerber = read(self.METRIC_FILE) gerber.offset(11, 5) gerber.write(outfile) def test_rotate(self): with self._check_result('RS2724x_rotate.gtl') as outfile: - gerber = panelize.read(self.METRIC_FILE) + gerber = read(self.METRIC_FILE) gerber.rotate(20, (10,10)) gerber.write(outfile) def test_single_quadrant(self): with self._check_result('RS2724x_single_quadrant.gtl') as outfile: - gerber = panelize.read(self.SQ_FILE) + gerber = read(self.SQ_FILE) gerber.write(outfile) diff --git a/gerbonara/gerber/tests/panelize/test_utility.py b/gerbonara/gerber/tests/panelize/test_utility.py index b32af8b..f632d90 100644 --- a/gerbonara/gerber/tests/panelize/test_utility.py +++ b/gerbonara/gerber/tests/panelize/test_utility.py @@ -9,21 +9,6 @@ from ...panelize.utility import * from math import sqrt class TestUtility(unittest.TestCase): - def test_rotate(self): - x0, y0 = (10, 0) - - x1, y1 = rotate(x0, y0, 60, (0, 0)) - self.assertAlmostEqual(x1, 5) - self.assertAlmostEqual(y1, 10 * sqrt(3) / 2) - - x1, y1 = rotate(x0, y0, 180, (5, 0)) - self.assertAlmostEqual(x1, 0) - self.assertAlmostEqual(y1, 0) - - x1, y1 = rotate(x0, y0, -90, (10, 5)) - self.assertAlmostEqual(x1, 5) - self.assertAlmostEqual(y1, 5) - def test_is_equal_value(self): a = 10.0001 b = 10.01 -- cgit