예제 #1
0
파일: script.py 프로젝트: mjoze/kurs_python
def home_field(number):
    sum_of_rooms = 0
    for i in range(number):
        a = input('Specify the length of the room {}'.format(i + 1))
        if a == '' or a.isalpha():
            print('tutaj')
            return home_field(number)
        else:
            a = int(a)
        b = input('Enter the width of the room {}'.format(i + 1))
        if b == '' or b.isalpha():
            print('tutaj')
            return home_field(number)
        else:
            b = int(b)
        sum_of_rooms += f.rectangle(a, b)
    return sum_of_rooms
예제 #2
0
 def test_rectangle_with_correct_values(self):
     self.assertEqual(rectangle(self.a, self.b), 500)
예제 #3
0
 def test_rectangle_with_incorrect_values(self):
     with self.assertRaises(ValueError):
         rectangle('***', self.b)
예제 #4
0
 def test_rectangle_with_correct_values(self):
     result = rectangle(self.a, self.b)
     self.assertEqual(result, 20)
예제 #5
0
 def test_rectangle_with_incorrect_value(self):
     with self.assertRaises(ValueError):
         rectangle(5, 'aaa')