예제 #1
0
    def test_ReadInput_2(self):
        _list = [
            4, 'base', 'second : base', 'otherbase', 'first : otherbase', 4,
            'base', 'otherbase', 'first', 'second'
        ]
        _Actual_1: list = []
        _Actual_2: list = []
        _Expected_1 = [['base'], ['second', ':', 'base'], ['otherbase'],
                       ['first', ':', 'otherbase']]
        _Expected_2 = [['base'], ['otherbase'], ['first'], ['second']]

        with patch('builtins.input', side_effect=_list):
            _Actual_1 = Exceptions.ReadInput()
            _Actual_2 = Exceptions.ReadInput()

            _user_input = []
예제 #2
0
    def test_ReadInput_3(self):
        _list = [
            4, "BaseException", "Exception : BaseException",
            "LookupError : Exception", "KeyError : LookupError", 2,
            "BaseException", "KeyError"
        ]
        _Actual_1: list = []
        _Actual_2: list = []
        _Expected_1 = [['BaseException'], ['Exception', ':', 'BaseException'],
                       ['LookupError', ':', 'Exception'],
                       ['KeyError', ':', 'LookupError']]
        _Expected_2 = [['BaseException'], ['KeyError']]

        with patch('builtins.input', side_effect=_list):
            _Actual_1 = Exceptions.ReadInput()
            _Actual_2 = Exceptions.ReadInput()
예제 #3
0
    def test_ReadInput_2(self):
        _list = [
            4, 'ArithmeticError', 'ZeroDivisionError : ArithmeticError',
            'OSError', 'FileNotFoundError : OSError', 4, 'ZeroDivisionError',
            'OSError', 'ArithmeticError', 'FileNotFoundError'
        ]
        _Actual_1: list = []
        _Actual_2: list = []
        _Expected_1 = [['ArithmeticError'],
                       ['ZeroDivisionError', ':', 'ArithmeticError'],
                       ['OSError'], ['FileNotFoundError', ':', 'OSError']]
        _Expected_2 = [['ZeroDivisionError'], ['OSError'], ['ArithmeticError'],
                       ['FileNotFoundError']]

        with patch('builtins.input', side_effect=_list):
            _Actual_1 = Exceptions.ReadInput()
            _Actual_2 = Exceptions.ReadInput()

        self.assertListEqual(_Actual_1, _Expected_1)
        self.assertListEqual(_Actual_2, _Expected_2)