def test_retriesexceeded_str_def(msg, details, connect_retries): """All tests for RetriesExceeded.str_def().""" exc = RetriesExceeded(msg, details, connect_retries) classname = exc.__class__.__name__ # Execute the code to be tested str_def = exc.str_def() str_def = ' ' + str_def assert str_def.find(' classname={!r};'.format(classname)) >= 0 assert str_def.find(' message={!r};'.format(msg)) >= 0 assert str_def.find(' connect_retries={!r};'.format(connect_retries)) >= 0
def test_retriesexceeded_str(self, msg, details, connect_retries): """All tests for RetriesExceeded.__str__().""" exc = RetriesExceeded(msg, details, connect_retries) exp_str = str(exc.args[0]) # Execute the code to be tested str_str = str(exc) assert str_str == exp_str
def test_retriesexceeded_repr(self, msg, details, connect_retries): """All tests for RetriesExceeded.__repr__().""" exc = RetriesExceeded(msg, details, connect_retries) classname = exc.__class__.__name__ # Execute the code to be tested repr_str = repr(exc) # We check the one-lined string just roughly repr_str = repr_str.replace('\n', '\\n') assert re.match(r'^{}\s*\(.*\)$'.format(classname), repr_str)
def test_retriesexceeded_initial_attrs(self, arg_names, args): """Test initial attributes of RetriesExceeded.""" msg, details, connect_retries = args posargs, kwargs = func_args(args, arg_names) # Execute the code to be tested exc = RetriesExceeded(*posargs, **kwargs) assert isinstance(exc, ConnectionError) assert len(exc.args) == 1 assert exc.args[0] == msg assert exc.details == details assert exc.connect_retries == connect_retries