コード例 #1
0
class TestSquare(unittest.TestCase):
    def setUp(self):
        self.a_square = Square(2)  # Square(side_weight)

    def it_creates_a_square(self):
        self.a_square | should | be_instance_of(Square)

    def it_changes_and_check_the_side_of_the_square(self):
        self.a_square.side = 3
        self.a_square.side | should | be(3)

    def it_takes_the_square_of_the_side(self):
        self.a_square.side = 5
        self.a_square.square() | should | be(25)
コード例 #2
0
 def setUp(self):
     self.a_square = Square(2)  # Square(side_weight)