Test the _print_header method.
()
| 170 | |
| 171 | |
| 172 | def test_print_header(): |
| 173 | """Test the _print_header method.""" |
| 174 | optimizer = BayesianOptimization(target_func, PBOUNDS, random_state=1) |
| 175 | logger = ScreenLogger() |
| 176 | |
| 177 | header_str = logger._print_header(optimizer._space.keys) |
| 178 | |
| 179 | # Check if header contains expected column names |
| 180 | assert "iter" in header_str |
| 181 | assert "target" in header_str |
| 182 | assert "p1" in header_str |
| 183 | assert "p2" in header_str |
| 184 | |
| 185 | # Check if divider line is included |
| 186 | assert "-" * 10 in header_str |
| 187 | |
| 188 | # Check with constrained logger |
| 189 | constrained_logger = ScreenLogger(is_constrained=True) |
| 190 | constrained_header = constrained_logger._print_header(optimizer._space.keys) |
| 191 | assert "allowed" in constrained_header |
| 192 | |
| 193 | |
| 194 | def test_is_new_max(): |
nothing calls this directly
no test coverage detected