Commit fb8dd214 authored by Jail Fernandez's avatar Jail Fernandez

Passed return test

parent 55a1b98a
class Polynomial:
def __init__(self, polystr='0'):
self.polystr = polystr
def __str__(self):
return self.polystr
from unittest import TestCase
from polynomials import Polynomial
# Graham wants to use the polynomial module to do such:
# >>> p1 = '2x^2 + 2x + 2'
# >>> p2 = '7x^3+3x^2+x'
# >>> p1 + p2
# >>> '7x^3 + 6x^2 + 3x + 2'
class PolynomialTesterSuite(TestCase):
def setUp(self):
self.p1 = Polynomial()
def test_default_polynomial_is_0(self):
self.assertTrue(str(self.p1), '0')
def test_create_constant_polynomials(self):
self.p2 = Polynomial('42')
self.assertTrue(str(self.p2), '42')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment