| Conditions | 1 |
| Total Lines | 26 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import copy |
||
| 63 | def test_catch_all_0(): |
||
| 64 | def objective_function(access): |
||
| 65 | x = y |
||
|
|
|||
| 66 | a = 1 + "str" |
||
| 67 | math.sqrt(-10) |
||
| 68 | x = 1 / 0 |
||
| 69 | |||
| 70 | return 0 |
||
| 71 | |||
| 72 | hyper = Hyperactive() |
||
| 73 | hyper.add_search( |
||
| 74 | objective_function, |
||
| 75 | search_space, |
||
| 76 | n_iter=100, |
||
| 77 | catch={ |
||
| 78 | NameError: np.nan, |
||
| 79 | TypeError: np.nan, |
||
| 80 | ValueError: np.nan, |
||
| 81 | ZeroDivisionError: np.nan, |
||
| 82 | }, |
||
| 83 | ) |
||
| 84 | hyper.run() |
||
| 85 | |||
| 86 | nan_ = hyper.search_data(objective_function)["score"].values[0] |
||
| 87 | |||
| 88 | assert math.isnan(nan_) |
||
| 89 | |||
| 121 |