Skip to content

Commit

Permalink
Add test: "fragment" usage
Browse files Browse the repository at this point in the history
Added test case for usage of python classes as fragment
Update code generation output
  • Loading branch information
dapalex committed Aug 14, 2023
1 parent 6fa15d5 commit d5d63f2
Show file tree
Hide file tree
Showing 21 changed files with 27,522 additions and 2,313 deletions.
1 change: 1 addition & 0 deletions pygqlmap/src/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def build(self, inputDict: dict, pyObject: any):
if not item[1] == None:
self.set_py_fields(item[1], pyObject)
else:
pyObject = item[1]
logger.info(item[0] + ' has no content')

except Exception as ex:
Expand Down
4 changes: 2 additions & 2 deletions tests/output/gdbc/gql_simple_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from .scalars import *
from .type_refs import *

class DWPRF_distance_Field(ArguedFloat):
class FRXHX_distance_Field(ArguedFloat):
"""
DWPRF_distance_Field - The distance result from some location-based query
FRXHX_distance_Field - The distance result from some location-based query
This field has two forms:
- As a property (e.g., place.distance), returns the distance as part of a query returning places sorted by distance.
- As a function (e.g., place.distance(toPlaceId), returns the distance to the specified place.
Expand Down
32 changes: 16 additions & 16 deletions tests/output/gdbc/gql_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class CountryPopulatedPlacesConnection(GQLObject):
edges: list_GQLObject[GQLObject] ## Circular Reference for PopulatedPlaceEdge
pageInfo: ConnectionPageInfo

class GBGMM_RegionPopulatedPlacesConnection_Field(Generic[RegionPopulatedPlacesConnection]):
class QRQPZ_RegionPopulatedPlacesConnection_Field(Generic[RegionPopulatedPlacesConnection]):
"""
GBGMM_RegionPopulatedPlacesConnection_Field - Find populated places in this region
QRQPZ_RegionPopulatedPlacesConnection_Field - Find populated places in this region
"""
class RegionPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):
Expand Down Expand Up @@ -178,7 +178,7 @@ class CountryRegion(GQLObject):
containingRegion: NewType('CountryRegion', GQLObject) ## Circular Reference for CountryRegion
country: NewType('Country', GQLObject) ## Circular Reference for Country
numPopulatedPlaces: int
populatedPlaces: GBGMM_RegionPopulatedPlacesConnection_Field ## Circular Reference for RegionPopulatedPlacesConnection
populatedPlaces: QRQPZ_RegionPopulatedPlacesConnection_Field ## Circular Reference for RegionPopulatedPlacesConnection

class CountryRegionEdge(GQLObject):
"""
Expand Down Expand Up @@ -209,9 +209,9 @@ class CountryRegionsConnection(GQLObject):
edges: list_CountryRegionEdge[CountryRegionEdge]
pageInfo: ConnectionPageInfo

class DPCBM_CountryPopulatedPlacesConnection_Field(CountryPopulatedPlacesConnection):
class VDSDT_CountryPopulatedPlacesConnection_Field(CountryPopulatedPlacesConnection):
"""
DPCBM_CountryPopulatedPlacesConnection_Field - Find populated places in this country
VDSDT_CountryPopulatedPlacesConnection_Field - Find populated places in this country
"""
class CountryPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):
Expand Down Expand Up @@ -260,9 +260,9 @@ class CountryPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):



class WYXBP_CountryRegion_Field(CountryRegion):
class RHEOX_CountryRegion_Field(CountryRegion):
"""
WYXBP_CountryRegion_Field - Look up a region in this country
RHEOX_CountryRegion_Field - Look up a region in this country
"""
class CountryRegionArgs(GQLArgsSet, GQLObject):
Expand All @@ -276,9 +276,9 @@ class CountryRegionArgs(GQLArgsSet, GQLObject):



class QOEGX_CountryRegionsConnection_Field(CountryRegionsConnection):
class HWGYK_CountryRegionsConnection_Field(CountryRegionsConnection):
"""
QOEGX_CountryRegionsConnection_Field - Find regions in this country
HWGYK_CountryRegionsConnection_Field - Find regions in this country
"""
class CountryRegionsConnectionArgs(GQLArgsSet, GQLObject):
Expand Down Expand Up @@ -347,9 +347,9 @@ class Country(GQLObject):
currencyCodes: list[str]
flagImageUri: str
numRegions: int
populatedPlaces: DPCBM_CountryPopulatedPlacesConnection_Field
region: WYXBP_CountryRegion_Field
regions: QOEGX_CountryRegionsConnection_Field
populatedPlaces: VDSDT_CountryPopulatedPlacesConnection_Field
region: RHEOX_CountryRegion_Field
regions: HWGYK_CountryRegionsConnection_Field

class NearbyPopulatedPlacesConnection(GQLObject):
"""
Expand All @@ -366,9 +366,9 @@ class NearbyPopulatedPlacesConnection(GQLObject):
edges: list_GQLObject[GQLObject] ## Circular Reference for PopulatedPlaceEdge
pageInfo: ConnectionPageInfo

class NEDFN_NearbyPopulatedPlacesConnection_Field(NearbyPopulatedPlacesConnection):
class LCAZH_NearbyPopulatedPlacesConnection_Field(NearbyPopulatedPlacesConnection):
"""
NEDFN_NearbyPopulatedPlacesConnection_Field - Find nearby populated places
LCAZH_NearbyPopulatedPlacesConnection_Field - Find nearby populated places
"""
class NearbyPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):
Expand Down Expand Up @@ -478,9 +478,9 @@ class PopulatedPlace(GQLObject):
timezone: str
country: Country
region: CountryRegion
distance: DWPRF_distance_Field
distance: FRXHX_distance_Field
locatedIn: NewType('PopulatedPlace', GQLObject) ## Circular Reference for PopulatedPlace
nearbyPopulatedPlaces: NEDFN_NearbyPopulatedPlacesConnection_Field
nearbyPopulatedPlaces: LCAZH_NearbyPopulatedPlacesConnection_Field
deleted: bool

class PopulatedPlaceEdge(GQLObject):
Expand Down
2 changes: 1 addition & 1 deletion tests/output/gdbc_nodesc/gql_simple_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .scalars import *
from .type_refs import *

class IXUFU_distance_Field(ArguedFloat):
class PFBPH_distance_Field(ArguedFloat):
class floatArgs(GQLArgsSet, GQLObject):
toPlaceId: ID
distanceUnit: DistanceUnit
Expand Down
22 changes: 11 additions & 11 deletions tests/output/gdbc_nodesc/gql_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CountryPopulatedPlacesConnection(GQLObject):
edges: list_GQLObject[GQLObject] ## Circular Reference for PopulatedPlaceEdge
pageInfo: ConnectionPageInfo

class INYWV_RegionPopulatedPlacesConnection_Field(Generic[RegionPopulatedPlacesConnection]):
class RDAZF_RegionPopulatedPlacesConnection_Field(Generic[RegionPopulatedPlacesConnection]):
class RegionPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):
namePrefix: str
namePrefixDefaultLangResults: bool
Expand Down Expand Up @@ -68,7 +68,7 @@ class CountryRegion(GQLObject):
containingRegion: NewType('CountryRegion', GQLObject) ## Circular Reference for CountryRegion
country: NewType('Country', GQLObject) ## Circular Reference for Country
numPopulatedPlaces: int
populatedPlaces: INYWV_RegionPopulatedPlacesConnection_Field ## Circular Reference for RegionPopulatedPlacesConnection
populatedPlaces: RDAZF_RegionPopulatedPlacesConnection_Field ## Circular Reference for RegionPopulatedPlacesConnection

class CountryRegionEdge(GQLObject):
cursor: str
Expand All @@ -81,7 +81,7 @@ class CountryRegionsConnection(GQLObject):
edges: list_CountryRegionEdge[CountryRegionEdge]
pageInfo: ConnectionPageInfo

class DCGDO_CountryPopulatedPlacesConnection_Field(CountryPopulatedPlacesConnection):
class LUXDF_CountryPopulatedPlacesConnection_Field(CountryPopulatedPlacesConnection):
class CountryPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):
namePrefix: str
namePrefixDefaultLangResults: bool
Expand All @@ -100,15 +100,15 @@ class CountryPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):



class XMBWA_CountryRegion_Field(CountryRegion):
class KRLEV_CountryRegion_Field(CountryRegion):
class CountryRegionArgs(GQLArgsSet, GQLObject):
code: ID

_args: CountryRegionArgs



class CFNUJ_CountryRegionsConnection_Field(CountryRegionsConnection):
class QJGAY_CountryRegionsConnection_Field(CountryRegionsConnection):
class CountryRegionsConnectionArgs(GQLArgsSet, GQLObject):
namePrefix: str
namePrefixDefaultLangResults: bool
Expand All @@ -131,16 +131,16 @@ class Country(GQLObject):
currencyCodes: list[str]
flagImageUri: str
numRegions: int
populatedPlaces: DCGDO_CountryPopulatedPlacesConnection_Field
region: XMBWA_CountryRegion_Field
regions: CFNUJ_CountryRegionsConnection_Field
populatedPlaces: LUXDF_CountryPopulatedPlacesConnection_Field
region: KRLEV_CountryRegion_Field
regions: QJGAY_CountryRegionsConnection_Field

class NearbyPopulatedPlacesConnection(GQLObject):
totalCount: int
edges: list_GQLObject[GQLObject] ## Circular Reference for PopulatedPlaceEdge
pageInfo: ConnectionPageInfo

class TRREB_NearbyPopulatedPlacesConnection_Field(NearbyPopulatedPlacesConnection):
class VDGWH_NearbyPopulatedPlacesConnection_Field(NearbyPopulatedPlacesConnection):
class NearbyPopulatedPlacesConnectionArgs(GQLArgsSet, GQLObject):
radius: float
distanceUnit: DistanceUnit
Expand Down Expand Up @@ -175,9 +175,9 @@ class PopulatedPlace(GQLObject):
timezone: str
country: Country
region: CountryRegion
distance: IXUFU_distance_Field
distance: PFBPH_distance_Field
locatedIn: NewType('PopulatedPlace', GQLObject) ## Circular Reference for PopulatedPlace
nearbyPopulatedPlaces: TRREB_NearbyPopulatedPlacesConnection_Field
nearbyPopulatedPlaces: VDGWH_NearbyPopulatedPlacesConnection_Field
deleted: bool

class PopulatedPlaceEdge(GQLObject):
Expand Down
Loading

0 comments on commit d5d63f2

Please sign in to comment.