def test_utf8_annotations(self): """ Annotations with special chars are handled correctly. """ design = KiCAD().parse(join(TEST_DIR, 'ps2toserial.sch')) JSONWriter().write(design, devnull)
def setUp(self): """ Set load the test files """ if KiCADTests.good is None: KiCADTests.good = JSON().parse(GOOD_OUTPUT_FILE) if KiCADTests.actual is None: KiCADTests.actual = KiCAD().parse(TEST_INPUT_FILE)
def test_parse_field(self): """ A field description with an embedded quote is parsed correctly. """ line = 'F 0 "Reference Designs ARE PROVIDED "AS IS"" H 1150 11950 120 0000 L B' ann = KiCAD().parse_field(0, 0, line) self.assertEqual(ann.value, 'Reference Designs ARE PROVIDED "AS IS"') self.assertEqual(ann.x, 1150) self.assertEqual(ann.y, -11950) self.assertEqual(ann.rotation, 0)
def test_annotation_spaces(self): """ Annotations with spaces are handled correctly. """ design = KiCAD().parse(join(TEST_DIR, 'jtag_schematic.sch')) inst = [ i for i in design.component_instances if i.library_id == 'CONN_4X2' ][0] self.assertEqual(inst.symbol_attributes[0].annotations[1].value, 'MAPLE JTAG')
def get_design(filename): if filename not in _cache: _cache[filename] = KiCAD().parse(join(TEST_DIR, filename)) return _cache[filename]