@pytest.mark.parametrize('path,format,extra_qs,expected', [('/foo?sql=select+1', 'csv', {}, '/foo.csv?sql=select+1'), ('/foo?sql=select+1', 'json', {}, '/foo.json?sql=select+1'), ('/foo/bar', 'json', {}, '/foo/bar.json'), ('/foo/bar', 'csv', {}, '/foo/bar.csv'), ('/foo/bar', 'csv', {'_dl': 1}, '/foo/bar.csv?_dl=1'), ('/sf-trees/Street_Tree_List?_search=cherry&_size=1000', 'csv', {'_dl': 1}, '/sf-trees/Street_Tree_List.csv?_search=cherry&_size=1000&_dl=1')])
def test_path_with_format(path, format, extra_qs, expected):
    request = Request.fake(path)
    actual = utils.path_with_format(request=request, format=format, extra_qs=extra_qs)
    assert (expected == actual)
@pytest.mark.parametrize('path,format,extra_qs,expected', [('/foo?sql=select+1', 'csv', {}, '/foo.csv?sql=select+1'), ('/foo?sql=select+1', 'json', {}, '/foo.json?sql=select+1'), ('/foo/bar', 'json', {}, '/foo/bar.json'), ('/foo/bar', 'csv', {}, '/foo/bar.csv'), ('/foo/bar', 'csv', {'_dl': 1}, '/foo/bar.csv?_dl=1'), ('/sf-trees/Street_Tree_List?_search=cherry&_size=1000', 'csv', {'_dl': 1}, '/sf-trees/Street_Tree_List.csv?_search=cherry&_size=1000&_dl=1')])
def test_path_with_format(path, format, extra_qs, expected):
    request = Request.fake(path)
    actual = utils.path_with_format(request=request, format=format, extra_qs=extra_qs)
    assert (expected == actual)