File tree 2 files changed +16
-3
lines changed
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):
2114
2114
return self ._properties
2115
2115
2116
2116
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 ()))
2118
2131
2119
2132
def __eq__ (self , other ):
2120
2133
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):
3711
3711
3712
3712
def test___repr___minimal (self ):
3713
3713
time_partitioning = self ._make_one ()
3714
- expected = "TimePartitioning(type= DAY)"
3714
+ expected = "TimePartitioning(type_=' DAY' )"
3715
3715
self .assertEqual (repr (time_partitioning ), expected )
3716
3716
3717
3717
def test___repr___explicit (self ):
@@ -3720,7 +3720,7 @@ def test___repr___explicit(self):
3720
3720
time_partitioning = self ._make_one (
3721
3721
type_ = TimePartitioningType .DAY , field = "name" , expiration_ms = 10000
3722
3722
)
3723
- expected = "TimePartitioning(" "expirationMs =10000," " field=name," "type= DAY)"
3723
+ expected = "TimePartitioning(expiration_ms =10000,field=' name',type_=' DAY' )"
3724
3724
self .assertEqual (repr (time_partitioning ), expected )
3725
3725
3726
3726
def test_set_expiration_w_none (self ):
You can’t perform that action at this time.
0 commit comments