@@ -82,14 +82,17 @@ def test_StringColumnProfile(self):
8282 self .assertEqual (column_profile .approximateNumDistinctValues , 3 )
8383 self .assertEqual (column_profile .typeCounts ["String" ], 3 )
8484 self .assertEqual (column_profile .isDataTypeInferred , False )
85- self .assertListEqual (
86- sorted (column_profile .histogram ),
87- [
88- DistributionValue ("bar" , 1 , 1 / 3 ),
89- DistributionValue ("bazz" , 1 , 1 / 3 ),
90- DistributionValue ("foo" , 1 , 1 / 3 ),
91- ]
92- )
85+ actual_histogram = sorted (column_profile .histogram , key = lambda x : x .value )
86+ self .assertEqual (len (actual_histogram ), 3 )
87+ expected_histogram = [
88+ DistributionValue ("bar" , 1 , 1 / 3 ),
89+ DistributionValue ("bazz" , 1 , 1 / 3 ),
90+ DistributionValue ("foo" , 1 , 1 / 3 ),
91+ ]
92+ for actual , expected in zip (actual_histogram , expected_histogram ):
93+ self .assertEqual (actual .value , expected .value )
94+ self .assertEqual (actual .count , expected .count )
95+ self .assertAlmostEquals (actual .ratio , expected .ratio )
9396
9497
9598if __name__ == "__main__" :
0 commit comments