示例#1
0
def test_set_x_step():
    # Create a Shape object from the header
    shape = Shape({
        'x_number': 143,
        'x_start': 84000,
        'x_step': 500,
        'x_stop': 155000,
        'y_number': 143,
        'y_start': 455000,
        'y_step': 500,
        'y_stop': 526000
    })

    # Set the x_step to 250
    shape.set_x_step(250)

    # Extract the dict from the Shape object
    shape_dict = shape.to_dict()

    # Compare with the desired input
    assert shape_dict == {
        'x_number': 285,
        'x_start': 84000,
        'x_step': 250,
        'x_stop': 155000,
        'y_number': 143,
        'y_start': 455000,
        'y_step': 500,
        'y_stop': 526000
    }
示例#2
0
def test_set_x_step_inf():
    # Create a Shape object from the header
    shape = Shape({
        'x_number': 143,
        'x_start': 84000,
        'x_step': 500,
        'x_stop': 155000,
        'y_number': 143,
        'y_start': 455000,
        'y_step': 500,
        'y_stop': 526000
    })

    # Set the x_step to nan
    step = np.inf
    shape.set_x_step(step)
    assert False