def addRecord(self, newID, newGender, newAge, newSales, newBMI, newIncome,
               autoID, overwrite):
     typeCheckStringERR(newID)
     preppedID = None
     invalidID = False
     origRec = None
     insertPos = None
     overwriteSignal = 0  # will become 1 if overwriting will be used
     try:
         preppedID = self._prepID(newID)
         origRec, insertPos = self._prot_findRecord(preppedID)
     except InvalidIDException:
         invalidID = True
     if origRec is not None and overwrite:
         overwriteSignal = 1
     elif (origRec is not None or invalidID) and autoID:
         preppedID, insertPos = self._autoID()
         # doNotUse, insertPos = self._prot_findRecord(preppedID)
     elif origRec is not None:
         raise DuplicateIDException()
     elif invalidID:
         raise InvalidIDException()
     newRec = Record(preppedID, newGender)
     self._allMyRecords[insertPos:insertPos + overwriteSignal] = [newRec]
     newRec.setAge(newAge)
     newRec.setSales(newSales)
     newRec.setBMI(newBMI)
     newRec.setIncome(newIncome)
 def test_NoChangeIncome02(self):
     """
     Expect sales to remain after attempting to set it to 406.5 (decimal)
     """
     expIncome = 410
     rec = Record(None, "F")
     """Default values proven in other test"""
     rec.setIncome(expIncome)
     rec.setIncome(406.5)
     self.assertEqual(expIncome, rec.getIncome())
 def test_NoChangeIncome01(self):
     """
     Expect income to remain after attempting to set it to 1000
     (over the limit)
     """
     expIncome = 999
     rec = Record(None, "M")
     """Default values proven in other test"""
     rec.setIncome(expIncome)
     rec.setIncome(1000)
     self.assertEquals(expIncome, rec.getIncome())
 def test_NoChangeIncome03(self):
     """
     Expect income to remain after attempting to set it to "A"
     String can be used for the method, but "A" represents no number
     """
     expIncome = 220
     incomeStr = str(220)
     rec = Record(None, "F")
     """Default values proven in other test"""
     rec.setIncome(incomeStr)
     rec.setIncome("A")
     self.assertEqual(expIncome, rec.getIncome())