Skip to content

bug: getBounds and getBounds2 in FitRecipe both return defaults even when bounds are set #158

Open

Description

@cadenmyers13

Problem

When trying to write a test for getBounds and getBounds2 they both return [-inf, inf] even when they are bounded,

def test_getBounds():
    recipe = FitRecipe("recipe")
    recipe.create_new_variable("var1", 1)
    recipe.restrain("var1", lb=-1, ub=1)
    actual_bounds = recipe.getBounds()
    expected_bounds = [(-1, 1)]
    assert actual_bounds == expected_bounds

def test_getBounds2():
    recipe = FitRecipe("recipe")
    recipe.create_new_variable("var1", 1)
    recipe.create_new_variable("var2", 2)
    recipe.restrain("var1", lb=0, ub=5)
    recipe.restrain("var2", lb=-1, ub=3)
    actual_lower_bounds, actual_upper_bounds = recipe.getBounds2()
    expected_lower_bounds = [0, -1]
    expected_upper_bounds = [5, 3]
    assert list(actual_lower_bounds) == expected_lower_bounds
    assert list(actual_upper_bounds) == expected_upper_bounds
FAILED tests/test_fitrecipe.py::test_getBounds - assert [[-inf, inf]] == [(-1, 1)]
FAILED tests/test_fitrecipe.py::test_getBounds2 - assert [np.float64(-...float64(-inf)] == [0, -1]

Proposed solution

  1. Implement the above two tests and fix the code to get it passing.
  2. These functions are going to be deprecated so make sure we are testing both the new and deprecated ones

Activity

  1. sbillinge commented on Feb 23, 2026

    @sbillinge
    Contributor

    haha, this is why we love tests....

  2. modified the milestones: 3.3.0, 3.4.0 on Aug 3, 2026
  3. modified the milestones: 3.4.0, 3.5.0 release on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions