@@ -160,6 +160,33 @@ def test_generate_data(self):
160
160
self .assertEqual (sorted (keys ), self .expected_points )
161
161
self .assertEqual (all (values ), True )
162
162
163
+ def test_reshape_data (self ):
164
+ test_points = [Point (x = 0.0 , y = 0.0 ),
165
+ Point (x = 0.0 , y = 0.5 ),
166
+ Point (x = 0.0 , y = 1.0 ),
167
+ Point (x = 0.5 , y = 0.0 ),
168
+ Point (x = 0.5 , y = 0.5 ),
169
+ Point (x = 0.5 , y = 1.0 ),
170
+ Point (x = 1.0 , y = 0.0 ),
171
+ Point (x = 1.0 , y = 0.5 ),
172
+ Point (x = 1.0 , y = 1.0 )]
173
+ test_data = {Point (x = 0.0 , y = 0.0 ): 5 ,
174
+ Point (x = 0.0 , y = 0.5 ): 9 ,
175
+ Point (x = 0.0 , y = 1.0 ): 3 ,
176
+ Point (x = 0.5 , y = 0.0 ): 8 ,
177
+ Point (x = 0.5 , y = 0.5 ): 2 ,
178
+ Point (x = 0.5 , y = 1.0 ): 4 ,
179
+ Point (x = 1.0 , y = 0.0 ): 2 ,
180
+ Point (x = 1.0 , y = 0.5 ): 1 ,
181
+ Point (x = 1.0 , y = 1.0 ): 9 }
182
+ test_shaped_data = [[3 , 4 , 9 ],
183
+ [9 , 2 , 1 ],
184
+ [5 , 8 , 2 ]]
185
+ af = AshlockFingerprint (self .strategy , self .probe )
186
+ plotting_data = af .reshape_data (test_data , test_points , 3 )
187
+ for i in range (len (plotting_data )):
188
+ self .assertEqual (list (plotting_data [i ]), test_shaped_data [i ])
189
+
163
190
def test_plot (self ):
164
191
af = AshlockFingerprint (self .strategy , self .probe )
165
192
af .fingerprint (turns = 10 , repetitions = 2 , step = 0.25 , progress_bar = False )
0 commit comments