mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 20:13:46 +00:00 
			
		
		
		
	test_logging_handlers: Fix strict_optional errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							dd7082e466
						
					
				
				
					commit
					c65e7772a7
				
			
							
								
								
									
										2
									
								
								mypy.ini
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								mypy.ini
									
									
									
									
									
								
							| @@ -40,8 +40,6 @@ strict_optional = True | ||||
|  | ||||
| # Tests (may be many issues in file; comment is just one error noted) | ||||
|  | ||||
| [mypy-zerver/tests/test_logging_handlers]  #73: error: Argument 7 to "makeRecord" of "Logger" has incompatible type "Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]"; expected "Union[Tuple[type, BaseException, TracebackType], Tuple[None, None, None], None]" | ||||
| strict_optional = False | ||||
| [mypy-zerver/tests/test_decorators]  #1322: error: Item "None" of "Optional[Match[str]]" has no attribute "groupdict" | ||||
| strict_optional = False | ||||
| [mypy-zerver/tests/test_auth_backends]  #2079: error: Incompatible types in assignment (expression has type "Optional[UserProfile]", variable has type "UserProfile") | ||||
|   | ||||
| @@ -2,7 +2,7 @@ import logging | ||||
| import sys | ||||
| from functools import wraps | ||||
| from types import TracebackType | ||||
| from typing import Callable, Dict, Iterator, NoReturn, Optional, Tuple, Type, cast | ||||
| from typing import Callable, Dict, Iterator, NoReturn, Optional, Tuple, Type, Union, cast | ||||
| from unittest.mock import MagicMock, patch | ||||
|  | ||||
| from django.conf import settings | ||||
| @@ -15,7 +15,7 @@ from zerver.lib.types import ViewFuncT | ||||
| from zerver.logging_handlers import AdminNotifyHandler, HasRequest | ||||
|  | ||||
| captured_request: Optional[HttpRequest] = None | ||||
| captured_exc_info: Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]] = None | ||||
| captured_exc_info: Optional[Union[Tuple[Type[BaseException], BaseException, TracebackType], Tuple[None, None, None]]] = None | ||||
| def capture_and_throw(domain: Optional[str]=None) -> Callable[[ViewFuncT], ViewFuncT]: | ||||
|     def wrapper(view_func: ViewFuncT) -> ViewFuncT: | ||||
|         @wraps(view_func) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user