mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 16:07:27 +03:00 
			
		
		
		
	Fixed Python 3.5 issues
This commit is contained in:
		
							parent
							
								
									6c4f4624e3
								
							
						
					
					
						commit
						907a3d9915
					
				|  | @ -23,7 +23,7 @@ def test_abstract_objecttype_warn_deprecation(mocker): | ||||||
|     class MyAbstractType(AbstractType): |     class MyAbstractType(AbstractType): | ||||||
|         field1 = MyScalar() |         field1 = MyScalar() | ||||||
| 
 | 
 | ||||||
|     abstracttype.warn_deprecation.assert_called_once() |     assert abstracttype.warn_deprecation.called | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def test_generate_objecttype_inherit_abstracttype(): | def test_generate_objecttype_inherit_abstracttype(): | ||||||
|  |  | ||||||
|  | @ -420,16 +420,16 @@ def test_query_annotated_resolvers(): | ||||||
|         context = String() |         context = String() | ||||||
|         info = String() |         info = String() | ||||||
| 
 | 
 | ||||||
|         @annotate |         @annotate(_trigger_warning=False) | ||||||
|         def resolve_annotated(self, id): |         def resolve_annotated(self, id): | ||||||
|             return "{}-{}".format(self, id) |             return "{}-{}".format(self, id) | ||||||
| 
 | 
 | ||||||
|         @annotate(context=Context) |         @annotate(context=Context, _trigger_warning=False) | ||||||
|         def resolve_context(self, context): |         def resolve_context(self, context): | ||||||
|             assert isinstance(context, Context) |             assert isinstance(context, Context) | ||||||
|             return "{}-{}".format(self, context.key) |             return "{}-{}".format(self, context.key) | ||||||
| 
 | 
 | ||||||
|         @annotate(info=ResolveInfo) |         @annotate(info=ResolveInfo, _trigger_warning=False) | ||||||
|         def resolve_info(self, info): |         def resolve_info(self, info): | ||||||
|             assert isinstance(info, ResolveInfo) |             assert isinstance(info, ResolveInfo) | ||||||
|             return "{}-{}".format(self, info.field_name) |             return "{}-{}".format(self, info.field_name) | ||||||
|  |  | ||||||
|  | @ -4,12 +4,10 @@ from .deprecated import deprecated | ||||||
| 
 | 
 | ||||||
| if PY2: | if PY2: | ||||||
|     deprecation_reason = ( |     deprecation_reason = ( | ||||||
|         'The decorator @resolve_only_args is deprecated.\n' |  | ||||||
|         'Please use @annotate instead.' |         'Please use @annotate instead.' | ||||||
|     ) |     ) | ||||||
| else: | else: | ||||||
|     deprecation_reason = ( |     deprecation_reason = ( | ||||||
|         'The decorator @resolve_only_args is deprecated.\n' |  | ||||||
|         'Please use Python 3 type annotations instead. Read more: ' |         'Please use Python 3 type annotations instead. Read more: ' | ||||||
|         'https://docs.python.org/3/library/typing.html' |         'https://docs.python.org/3/library/typing.html' | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|  | @ -17,17 +17,17 @@ func_with_annotations.__annotations__ = annotations | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def test_annotate_with_no_params(): | def test_annotate_with_no_params(): | ||||||
|     annotated_func = annotate(func) |     annotated_func = annotate(func, _trigger_warning=False) | ||||||
|     assert annotated_func.__annotations__ == {} |     assert annotated_func.__annotations__ == {} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def test_annotate_with_params(): | def test_annotate_with_params(): | ||||||
|     annotated_func = annotate(**annotations)(func) |     annotated_func = annotate(_trigger_warning=False, **annotations)(func) | ||||||
|     assert annotated_func.__annotations__ == annotations |     assert annotated_func.__annotations__ == annotations | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def test_annotate_with_wront_params(): | def test_annotate_with_wront_params(): | ||||||
|     with pytest.raises(Exception) as exc_info: |     with pytest.raises(Exception) as exc_info: | ||||||
|         annotated_func = annotate(p=int)(func) |         annotated_func = annotate(p=int, _trigger_warning=False)(func) | ||||||
| 
 | 
 | ||||||
|     assert str(exc_info.value) == 'The key p is not a function parameter in the function "func".' |     assert str(exc_info.value) == 'The key p is not a function parameter in the function "func".' | ||||||
|  |  | ||||||
|  | @ -10,4 +10,4 @@ def test_resolve_only_args(mocker): | ||||||
|     my_data = {'one': 1, 'two': 2} |     my_data = {'one': 1, 'two': 2} | ||||||
| 
 | 
 | ||||||
|     wrapped = resolve_only_args(resolver) |     wrapped = resolve_only_args(resolver) | ||||||
|     deprecated.warn_deprecation.assert_called_once() |     assert deprecated.warn_deprecation.called | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user