示例#1
0
def test_refine_x():
    # 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
    })

    # Refine shape with factor 2
    shape.refine_x(2)

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

    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_refine_x_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
    })

    # Refine the shape with factor NaN
    factor = np.inf
    shape.refine_x(factor)
    assert False