示例#1
0
def test_set_y_number_11():
    # 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 y number to 11
    shape.set_y_number(11)

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

    # todo: Compare with the desired output

    assert shape_dict == {
        'x_number': 143,
        'x_start': 84000,
        'x_step': 500,
        'x_stop': 155000,
        'y_number': 11,
        'y_start': 455000,
        'y_step': (526000 - 455000) / 10,
        'y_stop': 526000
    }
示例#2
0
def test_set_y_number_2():
    # 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 y number to 2
    shape.set_y_number(2)

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

    assert shape_dict == {
        'x_number': 143,
        'x_start': 84000,
        'x_step': 500,
        'x_stop': 155000,
        'y_number': 2,
        'y_start': 455000,
        'y_step': 526000 - 455000,
        'y_stop': 526000
    }
示例#3
0
def test_set_y_number_nan():
    # 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 y number to NaN
    shape.set_y_number(np.nan)
    assert False