Skip to content

Commit 6c53351

Browse files
committed
Add a test for an unsupported type (Tuple), and test it coerces back to String.
1 parent c57eada commit 6c53351

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Diff for: graphene_sqlalchemy/tests/models.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import datetime
44
import enum
55
from decimal import Decimal
6-
from typing import List
6+
from typing import List, Tuple
77

88
from sqlalchemy import (Column, Date, Enum, ForeignKey, Integer, String, Table,
99
func, select)
@@ -198,3 +198,9 @@ def hybrid_prop_first_shopping_cart_item(self) -> ShoppingCartItem:
198198
@hybrid_property
199199
def hybrid_prop_shopping_cart_item_list(self) -> List[ShoppingCartItem]:
200200
return [ShoppingCartItem(id=1), ShoppingCartItem(id=2)]
201+
202+
# Unsupported Type
203+
204+
@hybrid_property
205+
def hybrid_prop_unsupported_type_tuple(self) -> Tuple[str, str]:
206+
return "this will actually", "be a string"

Diff for: graphene_sqlalchemy/tests/test_converter.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ class Meta:
417417
"hybrid_prop_nested_list_int": List(List(Int)),
418418
"hybrid_prop_deeply_nested_list_int": List(List(List(Int))),
419419
"hybrid_prop_first_shopping_cart_item": ShoppingCartItemType,
420-
"hybrid_prop_shopping_cart_item_list": List(ShoppingCartItemType)
420+
"hybrid_prop_shopping_cart_item_list": List(ShoppingCartItemType),
421+
"hybrid_prop_unsupported_type_tuple": String,
421422
}
422423

423424
assert sorted(list(ShoppingCartType._meta.fields.keys())) == sorted([

0 commit comments

Comments
 (0)