File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -2114,7 +2114,20 @@ def to_api_repr(self):
21142114 return self ._properties
21152115
21162116 def _key (self ):
2117- return tuple (sorted (self ._properties .items ()))
2117+ # because we are only "renaming" top level keys shallow copy is sufficient here.
2118+ properties = self ._properties .copy ()
2119+ # calling repr for non built-in type objects.
2120+ properties ["type_" ] = repr (properties .pop ("type" ))
2121+ if "field" in properties :
2122+ # calling repr for non built-in type objects.
2123+ properties ["field" ] = repr (properties ["field" ])
2124+ if "requirePartitionFilter" in properties :
2125+ properties ["require_partition_filter" ] = properties .pop (
2126+ "requirePartitionFilter"
2127+ )
2128+ if "expirationMs" in properties :
2129+ properties ["expiration_ms" ] = properties .pop ("expirationMs" )
2130+ return tuple (sorted (properties .items ()))
21182131
21192132 def __eq__ (self , other ):
21202133 if not isinstance (other , TimePartitioning ):
Original file line number Diff line number Diff line change @@ -3711,7 +3711,7 @@ def test___hash__not_equals(self):
37113711
37123712 def test___repr___minimal (self ):
37133713 time_partitioning = self ._make_one ()
3714- expected = "TimePartitioning(type= DAY)"
3714+ expected = "TimePartitioning(type_=' DAY' )"
37153715 self .assertEqual (repr (time_partitioning ), expected )
37163716
37173717 def test___repr___explicit (self ):
@@ -3720,7 +3720,7 @@ def test___repr___explicit(self):
37203720 time_partitioning = self ._make_one (
37213721 type_ = TimePartitioningType .DAY , field = "name" , expiration_ms = 10000
37223722 )
3723- expected = "TimePartitioning(" "expirationMs =10000," " field=name," "type= DAY)"
3723+ expected = "TimePartitioning(expiration_ms =10000,field=' name',type_=' DAY' )"
37243724 self .assertEqual (repr (time_partitioning ), expected )
37253725
37263726 def test_set_expiration_w_none (self ):
You can’t perform that action at this time.
0 commit comments