11import pytest
22from django .db import models
33from django .utils .translation import ugettext_lazy as _
4+ from django .contrib .postgres .fields import ArrayField , HStoreField
5+
46from py .test import raises
57
68import graphene
79from graphene .relay import ConnectionField , Node
810from graphene .types .datetime import DateTime , Time
911from graphene .types .json import JSONString
1012
11- from ..compat import (ArrayField , HStoreField , JSONField , MissingType ,
12- RangeField , UUIDField , DurationField )
13+ from ..compat import JSONField , MissingType
1314from ..converter import convert_django_field , convert_django_field_with_choices
1415from ..registry import Registry
1516from ..types import DjangoObjectType
@@ -84,14 +85,12 @@ def test_should_auto_convert_id():
8485 assert_conversion (models .AutoField , graphene .ID , primary_key = True )
8586
8687
87- @pytest .mark .skipif (UUIDField == MissingType , reason = "requires Django UUIDField" )
8888def test_should_auto_convert_id ():
89- assert_conversion (UUIDField , graphene .ID )
89+ assert_conversion (models . UUIDField , graphene .ID )
9090
9191
92- @pytest .mark .skipif (DurationField == MissingType , reason = "requires Django DurationField" )
9392def test_should_auto_convert_duration ():
94- assert_conversion (DurationField , graphene .Float )
93+ assert_conversion (models . DurationField , graphene .Float )
9594
9695
9796def test_should_positive_integer_convert_int ():
@@ -265,17 +264,13 @@ class Meta:
265264 assert dynamic_field .type == A
266265
267266
268- @pytest .mark .skipif (ArrayField is MissingType ,
269- reason = "ArrayField should exist" )
270267def test_should_postgres_array_convert_list ():
271268 field = assert_conversion (ArrayField , graphene .List , models .CharField (max_length = 100 ))
272269 assert isinstance (field .type , graphene .NonNull )
273270 assert isinstance (field .type .of_type , graphene .List )
274271 assert field .type .of_type .of_type == graphene .String
275272
276273
277- @pytest .mark .skipif (ArrayField is MissingType ,
278- reason = "ArrayField should exist" )
279274def test_should_postgres_array_multiple_convert_list ():
280275 field = assert_conversion (ArrayField , graphene .List , ArrayField (models .CharField (max_length = 100 )))
281276 assert isinstance (field .type , graphene .NonNull )
@@ -284,8 +279,6 @@ def test_should_postgres_array_multiple_convert_list():
284279 assert field .type .of_type .of_type .of_type == graphene .String
285280
286281
287- @pytest .mark .skipif (HStoreField is MissingType ,
288- reason = "HStoreField should exist" )
289282def test_should_postgres_hstore_convert_string ():
290283 assert_conversion (HStoreField , JSONString )
291284
@@ -296,8 +289,6 @@ def test_should_postgres_json_convert_string():
296289 assert_conversion (JSONField , JSONString )
297290
298291
299- @pytest .mark .skipif (RangeField is MissingType ,
300- reason = "RangeField should exist" )
301292def test_should_postgres_range_convert_list ():
302293 from django .contrib .postgres .fields import IntegerRangeField
303294 field = assert_conversion (IntegerRangeField , graphene .List )
0 commit comments