def test_zero_exists_error(self): with self.assertRaises(bowling.ZerroExistsError): obj = bowling.CalculateResult(result="1110", name='Команда1') obj.run()
def test_wrong_first_symbol_error(self): with self.assertRaises(bowling.WrongFirstSymbolError): obj = bowling.CalculateResult(result="11/9", name='Команда1') obj.run()
def test_wrong_symbols_count_error(self): with self.assertRaises(bowling.WrongSymbolsCountError): obj = bowling.CalculateResult(result="111", name='Команда1') obj.run()
def test_double_slash_error(self): with self.assertRaises(bowling.DoubleSlashError): obj = bowling.CalculateResult(result="X//", name='Команда1') obj.run()
def test_wrong_symbol_error(self): with self.assertRaises(bowling.WrongSymbol): obj = bowling.CalculateResult(result='XXaa', name='Команда1') obj.run()
def test_over_ten_sum_error(self): with self.assertRaises(bowling.OverTenError): obj = bowling.CalculateResult(result="X99", name='Команда1') obj.run()
def test_too_many_sets_error(self): with self.assertRaises(bowling.TooManySets): obj = bowling.CalculateResult( result='XXXXXXXXXXXXXXXXXXXXXXXXXXXX', name='Команда1') obj.run()
def test_empty_list_error(self): with self.assertRaises(bowling.EmptyList): obj = bowling.CalculateResult(result=None, name='Команда1') obj.run()
def test_quantity_of_sets(self): obj = bowling.CalculateResult(result='Х4/34-4', name='Команда1') obj.run() result = obj.qnty_sets self.assertEqual(result, 4, 'количество фреймов не совпадает')
def test_result(self): obj = bowling.CalculateResult(result='Х4/34-4', name='Команда1') obj.run() result = obj.game_sum self.assertEqual(result, 46, 'количество очков не совпадает')
results = args.results # results = ["11--11", "Х4/34-4"] game_results = [] commands = ['команда 1', 'команда 2'] for i in range(2): # summ = enter_the_data(commands[i], results[i]) j = 0 game_sum = 0 while game_sum == 0: if j == 0: game_result = results[i] else: game_result = input('\nвведите результаты: ' + str(commands[i]) + '\n') objects = bowling.CalculateResult(result=game_result, name=commands[i]) try: objects.run() game_sum = objects.game_sum except IndexError as e: print(f'вышли за границы диапазона! ошибка {e.args}') game_sum = 0 except bowling.EmptyList as e: print(f'введи результаты игры! ошибка {e.args}') game_sum = 0 except bowling.TooManySets as e: print(f'ошибка: введено слишком много сетов ({e.args[0]})') game_sum = 0 except bowling.WrongSymbol as e: print(f'ошибка: введен неправильный символ в фрейме номер: ({e.args[0]})') game_sum = 0