def test_list_of_numbers():

    numbers = ListType(UnionType((IntType, FloatType)))
    result = numbers.convert(["2", "0.5", "123", "2.999"], None)
    assert result == [2, 0.5, 123, 2.999]
    assert [type(item) for item in result] == [int, float, int, float]
    assert [type(item) for item in numbers.to_primitive(result)] == [int, float, int, float]
dataset/ETHPy150Open schematics/schematics/tests/test_union_type.py/test_list_of_numbers/original