summaryrefslogtreecommitdiff
path: root/gerber/tests/test_common.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2015-10-14 15:37:02 -0300
committerPaulo Henrique Silva <ph.silva@gmail.com>2015-10-14 15:37:02 -0300
commit944c8329222b8c1166a4952df0ca553cbec71505 (patch)
treec9b4263852cf6e8a2f4003ac746011424d1edc69 /gerber/tests/test_common.py
parentb81c9d4bf96845ced3495eb158ec3a3c9e4dce3d (diff)
parent10d9028e1fdf7431baee73c7f1474d2134bac5fa (diff)
downloadgerbonara-944c8329222b8c1166a4952df0ca553cbec71505.tar.gz
gerbonara-944c8329222b8c1166a4952df0ca553cbec71505.tar.bz2
gerbonara-944c8329222b8c1166a4952df0ca553cbec71505.zip
Merge pull request #41 from curtacircuitos/read_from_memory
Read from memory
Diffstat (limited to 'gerber/tests/test_common.py')
-rw-r--r--gerber/tests/test_common.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/gerber/tests/test_common.py b/gerber/tests/test_common.py
index 76e3991..0ba4b68 100644
--- a/gerber/tests/test_common.py
+++ b/gerber/tests/test_common.py
@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
# Author: Hamilton Kibbe <ham@hamiltonkib.be>
-from ..common import read
+from ..common import read, loads
from ..excellon import ExcellonFile
from ..rs274x import GerberFile
from .tests import *
@@ -23,9 +23,20 @@ def test_file_type_detection():
assert_true(isinstance(ncdrill, ExcellonFile))
assert_true(isinstance(top_copper, GerberFile))
+
+def test_load_from_string():
+ with open(NCDRILL_FILE, 'r') as f:
+ ncdrill = loads(f.read())
+ with open(TOP_COPPER_FILE, 'r') as f:
+ top_copper = loads(f.read())
+ assert_true(isinstance(ncdrill, ExcellonFile))
+ assert_true(isinstance(top_copper, GerberFile))
+
+
def test_file_type_validation():
""" Test file format validation
"""
assert_raises(TypeError, read, 'LICENSE')
+