mirror of
				https://github.com/graphql-python/graphene.git
				synced 2025-10-31 16:07:27 +03:00 
			
		
		
		
	Allow the connection node to be wrapped in a NonNull type (#934)
				
					
				
			This commit is contained in:
		
							parent
							
								
									daf0d17647
								
							
						
					
					
						commit
						abff3d75a3
					
				|  | @ -53,7 +53,7 @@ class Connection(ObjectType): | |||
|     def __init_subclass_with_meta__(cls, node=None, name=None, **options): | ||||
|         _meta = ConnectionOptions(cls) | ||||
|         assert node, "You have to provide a node in {}.Meta".format(cls.__name__) | ||||
|         assert issubclass( | ||||
|         assert isinstance(node, NonNull) or issubclass( | ||||
|             node, (Scalar, Enum, ObjectType, Interface, Union, NonNull) | ||||
|         ), ('Received incompatible node "{}" for Connection {}.').format( | ||||
|             node, cls.__name__ | ||||
|  |  | |||
|  | @ -108,6 +108,17 @@ def test_edge_with_bases(): | |||
|     assert edge_fields["other"].type == String | ||||
| 
 | ||||
| 
 | ||||
| def test_edge_with_nonnull_node(): | ||||
|     class MyObjectConnection(Connection): | ||||
|         class Meta: | ||||
|             node = NonNull(MyObject) | ||||
| 
 | ||||
|     edge_fields = MyObjectConnection.Edge._meta.fields | ||||
|     assert isinstance(edge_fields["node"], Field) | ||||
|     assert isinstance(edge_fields["node"].type, NonNull) | ||||
|     assert edge_fields["node"].type.of_type == MyObject | ||||
| 
 | ||||
| 
 | ||||
| def test_pageinfo(): | ||||
|     assert PageInfo._meta.name == "PageInfo" | ||||
|     fields = PageInfo._meta.fields | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user