@@ -363,7 +363,7 @@ def test_get_max_partition_from_valid_part_specs_and_none_filter_map(self):
363
363
None )
364
364
365
365
# No partition will be filtered out.
366
- self .assertEqual (max_partition , b 'value3' )
366
+ self .assertEqual (max_partition , 'value3' )
367
367
368
368
def test_get_max_partition_from_valid_part_specs (self ):
369
369
max_partition = \
@@ -372,7 +372,16 @@ def test_get_max_partition_from_valid_part_specs(self):
372
372
{'key1' : 'value3' , 'key2' : 'value4' }],
373
373
'key1' ,
374
374
self .VALID_FILTER_MAP )
375
- self .assertEqual (max_partition , b'value1' )
375
+ self .assertEqual (max_partition , 'value1' )
376
+
377
+ def test_get_max_partition_from_valid_part_specs_return_type (self ):
378
+ max_partition = \
379
+ HiveMetastoreHook ._get_max_partition_from_part_specs (
380
+ [{'key1' : 'value1' , 'key2' : 'value2' },
381
+ {'key1' : 'value3' , 'key2' : 'value4' }],
382
+ 'key1' ,
383
+ self .VALID_FILTER_MAP )
384
+ self .assertIsInstance (max_partition , str )
376
385
377
386
@mock .patch ("airflow.providers.apache.hive.hooks.hive.HiveMetastoreHook.get_connection" ,
378
387
return_value = [Connection (host = "localhost" , port = "9802" )])
@@ -523,7 +532,7 @@ def test_max_partition(self):
523
532
table_name = self .table ,
524
533
field = self .partition_by ,
525
534
filter_map = filter_map )
526
- self .assertEqual (partition , DEFAULT_DATE_DS . encode ( 'utf-8' ) )
535
+ self .assertEqual (partition , DEFAULT_DATE_DS )
527
536
528
537
metastore .get_table .assert_called_with (
529
538
dbname = self .database , tbl_name = self .table )
0 commit comments