def setUp(self): ''' Set up test variables and loggers ''' self.schFilename = os.path.join(os.getcwd(), 'testSchematic.sch') self.bomFilename = os.path.join(os.getcwd(), 'testSchematic.bom') self.logger = logging.getLogger('testSchematicParser') self.logger.setLevel(logging.INFO) #handler = logging.StreamHandler() handler = logging.NullHandler() self.logger.addHandler(handler) ''' BomOrganizer ''' ''' Parse Schematic File ''' self.parser = sp.SchematicParser(self.schFilename, self.logger) self.bomOrganizer = bo.BOMOrganizer(self.parser.parse())
def testIter(self): self.bom = bo.BOMOrganizer(self._createDummyComponentList()) for component in self.bom: self.assertTrue(component.hasAttribute('refdes'))
def testParsedSchematic(self): self.bom = bo.BOMOrganizer(self._getSchematicComponentList()) self.assertEqual(self.bom.getBOM()[0].getQuantity(), 4, "BOMOrganizer problem parsing from schematic")
def testParsedSchematicWithVendorParse(self): self.bom = bo.BOMOrganizer(self._getSchematicComponentList()) self.bom.addVendorInfo()
def testOrganize(self): self.bom = bo.BOMOrganizer(self._createDummyComponentList()) self.assertEqual(self.bom.getBOM()[0].getQuantity(), 2, "Organize function not correct")