def computing(self): first_poly = Polynomial.from_string(self.first_poly) second_poly = Polynomial.from_string(self.second_poly) if first_poly and second_poly: if self.operation == '+': self.result = str(first_poly + second_poly) elif self.operation == '-': self.result = str(first_poly - second_poly) elif self.operation == '*': self.result = str(first_poly * second_poly) else: self.result = 'Coeff has no type int'
def test_error_val(self): self.assertEqual(False, Polynomial.from_string('1,2,a'))
def test_from_string(self): self.assertEqual(Polynomial([1, 2, 3]), Polynomial.from_string('1,2,3'))