|
23 | 23 |
|
24 | 24 | from matplotlib.figure import Figure
|
25 | 25 | from matplotlib.axes import Axes
|
26 |
| -import matplotlib.pyplot as plt |
27 | 26 |
|
28 | 27 |
|
29 | 28 | @qiita_test_checker()
|
@@ -1330,62 +1329,65 @@ def setUp(self):
|
1330 | 1329 | self.df.dropna(subset=['samples', 'columns'], inplace=True)
|
1331 | 1330 | self.df[self.col_name] = self.df.samples * self.df['columns']
|
1332 | 1331 |
|
1333 |
| - def test_plot_return(self): |
1334 |
| - # check the plot returns correct objects |
1335 |
| - fig1, axs1 = qdb.util.resource_allocation_plot(self.df, self.col_name, |
1336 |
| - self.df[self.col_name]) |
1337 |
| - self.assertIsInstance( |
1338 |
| - fig1, Figure, |
1339 |
| - "Returned object fig1 is not a Matplotlib Figure") |
1340 |
| - for ax in axs1: |
1341 |
| - self.assertIsInstance( |
1342 |
| - ax, Axes, |
1343 |
| - "Returned object axs1 is not a single Matplotlib Axes object") |
1344 |
| - |
1345 |
| - def test_minimize_const(self): |
1346 |
| - |
1347 |
| - fig, axs = plt.subplots(ncols=2, figsize=(10, 4), sharey=False) |
1348 |
| - |
1349 |
| - mem_models, time_models = qdb.util._retrieve_equations() |
1350 |
| - bm_name, bm, options = qdb.util._resource_allocation_plot_helper( |
1351 |
| - self.df, axs[0], 'MaxRSSRaw', mem_models, self.col_name) |
1352 |
| - # check that the algorithm chooses correct model for MaxRSSRaw and |
1353 |
| - # has 0 failures |
1354 |
| - k, a, b = options.x |
1355 |
| - failures_df = qdb.util._resource_allocation_success_failures( |
1356 |
| - self.df, k, a, b, bm, self.col_name, 'MaxRSSRaw')[-1] |
1357 |
| - failures = failures_df.shape[0] |
1358 |
| - |
1359 |
| - self.assertEqual(bm_name, 'mem_model4', |
1360 |
| - msg=f"""Best memory model |
1361 |
| - doesn't match |
1362 |
| - {bm_name} != 'mem_model4'""") |
1363 |
| - self.assertEqual(bm, mem_models['mem_model4']['equation'], |
1364 |
| - msg=f"""Best memory model |
1365 |
| - doesn't match |
1366 |
| - Coefficients:{k} {a} {b} |
1367 |
| - """) |
1368 |
| - self.assertEqual(failures, 0, "Number of failures must be 0") |
1369 |
| - |
1370 |
| - # check that the algorithm chooses correct model for ElapsedRaw and |
1371 |
| - # has 1 failure |
1372 |
| - bm_name, bm, options = qdb.util._resource_allocation_plot_helper( |
1373 |
| - self.df, axs[1], 'ElapsedRaw', time_models, self.col_name) |
1374 |
| - k, a, b = options.x |
1375 |
| - failures_df = qdb.util._resource_allocation_success_failures( |
1376 |
| - self.df, k, a, b, bm, self.col_name, 'ElapsedRaw')[-1] |
1377 |
| - failures = failures_df.shape[0] |
1378 |
| - self.assertEqual(bm_name, 'time_model4', |
1379 |
| - msg=f"""Best time model |
1380 |
| - doesn't match |
1381 |
| - {bm_name} != 'time_model4'""") |
1382 |
| - |
1383 |
| - self.assertEqual(bm, time_models[bm_name]['equation'], |
1384 |
| - msg=f"""Best time model |
1385 |
| - doesn't match |
1386 |
| - Coefficients:{k} {a} {b} |
1387 |
| - """) |
1388 |
| - self.assertEqual(failures, 0, "Number of failures must be 0") |
| 1332 | + # def test_plot_return(self): |
| 1333 | + # # check the plot returns correct objects |
| 1334 | + # fig1, axs1 = qdb.util.resource_allocation_plot(self.df, |
| 1335 | + # self.col_name, |
| 1336 | + # self.df[self.col_name] |
| 1337 | + # ) |
| 1338 | + # self.assertIsInstance( |
| 1339 | + # fig1, Figure, |
| 1340 | + # "Returned object fig1 is not a Matplotlib Figure") |
| 1341 | + # for ax in axs1: |
| 1342 | + # self.assertIsInstance( |
| 1343 | + # ax, Axes, |
| 1344 | + # "Returned object axs1 is not a single Matplotlib Axes object" |
| 1345 | + # ) |
| 1346 | + |
| 1347 | + # def test_minimize_const(self): |
| 1348 | + |
| 1349 | + # fig, axs = plt.subplots(ncols=2, figsize=(10, 4), sharey=False) |
| 1350 | + |
| 1351 | + # mem_models, time_models = qdb.util._retrieve_equations() |
| 1352 | + # bm_name, bm, options = qdb.util._resource_allocation_plot_helper( |
| 1353 | + # self.df, axs[0], 'MaxRSSRaw', mem_models, self.col_name) |
| 1354 | + # # check that the algorithm chooses correct model for MaxRSSRaw and |
| 1355 | + # # has 0 failures |
| 1356 | + # k, a, b = options.x |
| 1357 | + # failures_df = qdb.util._resource_allocation_success_failures( |
| 1358 | + # self.df, k, a, b, bm, self.col_name, 'MaxRSSRaw')[-1] |
| 1359 | + # failures = failures_df.shape[0] |
| 1360 | + |
| 1361 | + # self.assertEqual(bm_name, 'mem_model4', |
| 1362 | + # msg=f"""Best memory model |
| 1363 | + # doesn't match |
| 1364 | + # {bm_name} != 'mem_model4'""") |
| 1365 | + # self.assertEqual(bm, mem_models['mem_model4']['equation'], |
| 1366 | + # msg=f"""Best memory model |
| 1367 | + # doesn't match |
| 1368 | + # Coefficients:{k} {a} {b} |
| 1369 | + # """) |
| 1370 | + # self.assertEqual(failures, 0, "Number of failures must be 0") |
| 1371 | + |
| 1372 | + # # check that the algorithm chooses correct model for ElapsedRaw and |
| 1373 | + # # has 1 failure |
| 1374 | + # bm_name, bm, options = qdb.util._resource_allocation_plot_helper( |
| 1375 | + # self.df, axs[1], 'ElapsedRaw', time_models, self.col_name) |
| 1376 | + # k, a, b = options.x |
| 1377 | + # failures_df = qdb.util._resource_allocation_success_failures( |
| 1378 | + # self.df, k, a, b, bm, self.col_name, 'ElapsedRaw')[-1] |
| 1379 | + # failures = failures_df.shape[0] |
| 1380 | + # self.assertEqual(bm_name, 'time_model4', |
| 1381 | + # msg=f"""Best time model |
| 1382 | + # doesn't match |
| 1383 | + # {bm_name} != 'time_model4'""") |
| 1384 | + |
| 1385 | + # self.assertEqual(bm, time_models[bm_name]['equation'], |
| 1386 | + # msg=f"""Best time model |
| 1387 | + # doesn't match |
| 1388 | + # Coefficients:{k} {a} {b} |
| 1389 | + # """) |
| 1390 | + # self.assertEqual(failures, 0, "Number of failures must be 0") |
1389 | 1391 |
|
1390 | 1392 | def test_MaxRSS_helper(self):
|
1391 | 1393 | tests = [
|
|
0 commit comments