@@ -17,9 +17,6 @@ data = {
1717# Create figure and axis 
1818fig, ax = plt.subplots(figsize=(10, 6)) 
1919
20- # Plot box plot 
21- ax.boxplot(data.values(), labels=data.keys()) 
22- 
2320# Customize plot 
2421ax.set_title('Exam Scores Distribution') 
2522ax.set_xlabel('Class') 
@@ -52,12 +49,11 @@ plt.show()
5249  const  bars  =  chart . elements 
5350  expect ( bars . length ) . toBe ( 3 ) 
5451
55-   bars . forEach ( ( bar : any )  =>  { 
56-     expect ( typeof  bar . min ) . toBe ( 'number' ) 
57-     expect ( typeof  bar . first_quartile ) . toBe ( 'number' ) 
58-     expect ( typeof  bar . median ) . toBe ( 'number' ) 
59-     expect ( typeof  bar . third_quartile ) . toBe ( 'number' ) 
60-     expect ( typeof  bar . max ) . toBe ( 'number' ) 
61-     expect ( typeof  bar . label ) . toBe ( 'string' ) 
62-   } ) 
52+   expect ( bars . map ( ( bar )  =>  bar . label ) ) . toEqual ( [ 'Class A' ,  'Class B' ,  'Class C' ] ) 
53+   expect ( bars . map ( ( bar )  =>  bar . outliers ) ) . toEqual ( [ [ ] ,  [ 76 ] ,  [ ] ] ) 
54+   expect ( bars . map ( ( bar )  =>  bar . min ) ) . toEqual ( [ 78 ,  84 ,  75 ] ) 
55+   expect ( bars . map ( ( bar )  =>  bar . first_quartile ) ) . toEqual ( [ 85 ,  84.75 ,  79 ] ) 
56+   expect ( bars . map ( ( bar )  =>  bar . median ) ) . toEqual ( [ 88 ,  88 ,  82 ] ) 
57+   expect ( bars . map ( ( bar )  =>  bar . third_quartile ) ) . toEqual ( [ 90 ,  90.5 ,  86 ] ) 
58+   expect ( bars . map ( ( bar )  =>  bar . max ) ) . toEqual ( [ 92 ,  95 ,  88 ] ) 
6359} ) 
0 commit comments