|
9 | 9 | import RATapi |
10 | 10 | import RATapi.wrappers |
11 | 11 | from RATapi.inputs import FileHandles, check_indices, make_controls, make_input, make_problem |
12 | | -from RATapi.rat_core import Checks, Control, Limits, NameStore, ProblemDefinition |
| 12 | +from RATapi.rat_core import Checks, Control, NameStore, ProblemDefinition |
13 | 13 | from RATapi.utils.enums import ( |
14 | 14 | BackgroundActions, |
15 | 15 | BoundHandling, |
@@ -351,36 +351,6 @@ def custom_xy_problem(test_names, test_checks): |
351 | 351 | return problem |
352 | 352 |
|
353 | 353 |
|
354 | | -@pytest.fixture |
355 | | -def normal_limits(): |
356 | | - """The expected limits object from "standard_layers_project" and "custom_xy_project".""" |
357 | | - limits = Limits() |
358 | | - limits.params = [[1.0, 5.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] |
359 | | - limits.backgroundParams = [[1e-7, 1e-5]] |
360 | | - limits.scalefactors = [[0.02, 0.25]] |
361 | | - limits.bulkIns = [[0.0, 0.0]] |
362 | | - limits.bulkOuts = [[6.2e-6, 6.35e-6]] |
363 | | - limits.resolutionParams = [[0.01, 0.05]] |
364 | | - limits.domainRatios = [] |
365 | | - |
366 | | - return limits |
367 | | - |
368 | | - |
369 | | -@pytest.fixture |
370 | | -def domains_limits(): |
371 | | - """The expected limits object from "domains_project".""" |
372 | | - limits = Limits() |
373 | | - limits.params = [[1.0, 5.0], [0.0, 0.0], [0.0, 0.0], [0.0, 0.0]] |
374 | | - limits.backgroundParams = [[1e-7, 1e-5]] |
375 | | - limits.scalefactors = [[0.02, 0.25]] |
376 | | - limits.bulkIns = [[0.0, 0.0]] |
377 | | - limits.bulkOuts = [[6.2e-6, 6.35e-6]] |
378 | | - limits.resolutionParams = [[0.01, 0.05]] |
379 | | - limits.domainRatios = [[0.4, 0.6]] |
380 | | - |
381 | | - return limits |
382 | | - |
383 | | - |
384 | 354 | @pytest.fixture |
385 | 355 | def standard_layers_controls(): |
386 | 356 | """The expected controls object for input to the compiled RAT code given the default inputs and |
@@ -458,55 +428,38 @@ def custom_xy_controls(): |
458 | 428 |
|
459 | 429 |
|
460 | 430 | @pytest.mark.parametrize( |
461 | | - ["test_project", "test_problem", "test_limits", "test_controls"], |
| 431 | + ["test_project", "test_problem", "test_controls"], |
462 | 432 | [ |
463 | 433 | ( |
464 | 434 | "standard_layers_project", |
465 | 435 | "standard_layers_problem", |
466 | | - "normal_limits", |
467 | 436 | "standard_layers_controls", |
468 | 437 | ), |
469 | 438 | ( |
470 | 439 | "custom_xy_project", |
471 | 440 | "custom_xy_problem", |
472 | | - "normal_limits", |
473 | 441 | "custom_xy_controls", |
474 | 442 | ), |
475 | 443 | ( |
476 | 444 | "domains_project", |
477 | 445 | "domains_problem", |
478 | | - "domains_limits", |
479 | 446 | "standard_layers_controls", |
480 | 447 | ), |
481 | 448 | ], |
482 | 449 | ) |
483 | | -def test_make_input(test_project, test_problem, test_limits, test_controls, request) -> None: |
484 | | - """When converting the "project" and "controls", we should obtain the five input objects required for the compiled |
| 450 | +def test_make_input(test_project, test_problem, test_controls, request) -> None: |
| 451 | + """When converting the "project" and "controls", we should obtain the two input objects required for the compiled |
485 | 452 | RAT code. |
486 | 453 | """ |
487 | 454 | test_project = request.getfixturevalue(test_project) |
488 | 455 | test_problem = request.getfixturevalue(test_problem) |
489 | | - test_limits = request.getfixturevalue(test_limits) |
490 | 456 | test_controls = request.getfixturevalue(test_controls) |
491 | 457 |
|
492 | | - parameter_fields = [ |
493 | | - "params", |
494 | | - "backgroundParams", |
495 | | - "scalefactors", |
496 | | - "bulkIns", |
497 | | - "bulkOuts", |
498 | | - "resolutionParams", |
499 | | - "domainRatios", |
500 | | - ] |
| 458 | + problem, controls = make_input(test_project, RATapi.Controls()) |
501 | 459 |
|
502 | | - problem, limits, controls = make_input(test_project, RATapi.Controls()) |
503 | 460 | problem = pickle.loads(pickle.dumps(problem)) |
504 | 461 | check_problem_equal(problem, test_problem) |
505 | 462 |
|
506 | | - limits = pickle.loads(pickle.dumps(limits)) |
507 | | - for limit_field in parameter_fields: |
508 | | - assert np.all(getattr(limits, limit_field) == getattr(test_limits, limit_field)) |
509 | | - |
510 | 463 | controls = pickle.loads(pickle.dumps(controls)) |
511 | 464 | check_controls_equal(controls, test_controls) |
512 | 465 |
|
|
0 commit comments