@@ -86,14 +86,17 @@ def test_StringColumnProfile(self):
8686 self .assertEqual (column_profile .approximateNumDistinctValues , 3 )
8787 self .assertEqual (column_profile .typeCounts ["String" ], 3 )
8888 self .assertEqual (column_profile .isDataTypeInferred , False )
89- self .assertListEqual (
90- sorted (column_profile .histogram ),
91- [
92- DistributionValue ("bar" , 1 , 1 / 3 ),
93- DistributionValue ("bazz" , 1 , 1 / 3 ),
94- DistributionValue ("foo" , 1 , 1 / 3 ),
95- ]
96- )
89+ actual_histogram = sorted (column_profile .histogram , key = lambda x : x .value )
90+ self .assertEqual (len (actual_histogram ), 3 )
91+ expected_histogram = [
92+ DistributionValue ("bar" , 1 , 1 / 3 ),
93+ DistributionValue ("bazz" , 1 , 1 / 3 ),
94+ DistributionValue ("foo" , 1 , 1 / 3 ),
95+ ]
96+ for actual , expected in zip (actual_histogram , expected_histogram ):
97+ self .assertEqual (actual .value , expected .value )
98+ self .assertEqual (actual .count , expected .count )
99+ self .assertAlmostEquals (actual .ratio , expected .ratio )
97100
98101
99102if __name__ == "__main__" :
0 commit comments