

def test_url_query_optional():
    mock = Mock()
    mock.request.args.get.return_value = None
    url_query = URLQueryProperty(name='d', type=float, required=False)
    rv = url_query.provide_value(mock)
    assert (rv is None)
    mock.request.args.get.assert_called_once_with('d', type=float)

dataset/ETHPy150Open douban/brownant/tests/test_pipeline/test_network.py test_url_query_optional/original