From d0f836ecfadacbaea20fc6a3ceebd455e96e1307 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 13 Jun 2021 20:33:19 +0200 Subject: Port old pcb-tools-extension unit tests to pytest --- tests/test_rs274x.py | 76 ---------------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 tests/test_rs274x.py (limited to 'tests/test_rs274x.py') diff --git a/tests/test_rs274x.py b/tests/test_rs274x.py deleted file mode 100644 index 1a1475a..0000000 --- a/tests/test_rs274x.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -# Copyright 2019 Hiroshi Murayama - -import os -import unittest -from gerbonara.gerber import panelize - -class TestRs274x(unittest.TestCase): - @classmethod - def setUpClass(cls): - os.chdir(os.path.dirname(__file__)) - cls.INDIR = 'data' - cls.OUTDIR = 'outputs' - cls.EXPECTSDIR = 'expects' - cls.OUTPREFIX = 'RS2724x_' - cls.METRIC_FILE = os.path.join(cls.INDIR, 'ref_gerber_metric.gtl') - cls.INCH_FILE = os.path.join(cls.INDIR, 'ref_gerber_inch.gtl') - cls.SQ_FILE = os.path.join(cls.INDIR, 'ref_gerber_single_quadrant.gtl') - try: - os.mkdir(cls.OUTDIR) - except FileExistsError: - pass - - def _checkResult(self, file): - with open(file, 'r') as f: - data = f.read() - with open(os.path.join(self.EXPECTSDIR, os.path.basename(file)), 'r') as f: - expect = f.read() - self.assertEqual(data, expect) - - def test_save(self): - outfile=os.path.join(self.OUTDIR, self.OUTPREFIX + 'save.gtl') - gerber = panelize.read(self.METRIC_FILE) - gerber.write(outfile) - self._checkResult(outfile) - - def test_to_inch(self): - outfile = os.path.join(self.OUTDIR, self.OUTPREFIX + 'to_inch.gtl') - gerber = panelize.read(self.METRIC_FILE) - gerber.to_inch() - gerber.format = (2,5) - gerber.write(outfile) - self._checkResult(outfile) - - def test_to_metric(self): - outfile = os.path.join(self.OUTDIR, self.OUTPREFIX + 'to_metric.gtl') - gerber = panelize.read(self.INCH_FILE) - gerber.to_metric() - gerber.format = (3, 4) - gerber.write(outfile) - self._checkResult(outfile) - - def test_offset(self): - outfile = os.path.join(self.OUTDIR, self.OUTPREFIX + 'offset.gtl') - gerber = panelize.read(self.METRIC_FILE) - gerber.offset(11, 5) - gerber.write(outfile) - self._checkResult(outfile) - - def test_rotate(self): - outfile = os.path.join(self.OUTDIR, self.OUTPREFIX + 'rotate.gtl') - gerber = panelize.read(self.METRIC_FILE) - gerber.rotate(20, (10,10)) - gerber.write(outfile) - self._checkResult(outfile) - - def test_single_quadrant(self): - outfile = os.path.join(self.OUTDIR, self.OUTPREFIX + 'single_quadrant.gtl') - gerber = panelize.read(self.SQ_FILE) - gerber.write(outfile) - self._checkResult(outfile) - -if __name__ == '__main__': - unittest.main() -- cgit