def setDiscipline(self, new_disc): ''' Checks if the new discipline is a string and sets it, otherwise it does nothing Parameters: new_disc - discipline ''' if Utility.isString(new_disc) == True: self._discipline = new_disc else: return False
def setTeacher(self, new_teach): ''' Checks it the teacher's name is a string and sets it, otherwise it does nothing Parameters: new_teach - name of the teacher ''' if Utility.isString(new_teach): self._teacher = new_teach else: return False
def _test_utility_isString(self): ''' Tests if detecting a string works ''' assert Utility.isString("john") == True assert Utility.isString(1) == False assert Utility.isString("") == True assert Utility.isString(" a ") == True assert Utility.isString([]) == False assert Utility.isString(7.5) == False assert Utility.isString(True) == False