chore(api/tests): apply ruff reformat #7590 (#7591)

Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
Bowen Liang
2024-08-23 23:52:25 +08:00
committed by GitHub
parent 2da63654e5
commit b035c02f78
155 changed files with 4279 additions and 5925 deletions

View File

@@ -3,21 +3,21 @@ from yarl import URL
def test_yarl_urls():
expected_1 = 'https://dify.ai/api'
assert str(URL('https://dify.ai') / 'api') == expected_1
assert str(URL('https://dify.ai/') / 'api') == expected_1
expected_1 = "https://dify.ai/api"
assert str(URL("https://dify.ai") / "api") == expected_1
assert str(URL("https://dify.ai/") / "api") == expected_1
expected_2 = 'http://dify.ai:12345/api'
assert str(URL('http://dify.ai:12345') / 'api') == expected_2
assert str(URL('http://dify.ai:12345/') / 'api') == expected_2
expected_2 = "http://dify.ai:12345/api"
assert str(URL("http://dify.ai:12345") / "api") == expected_2
assert str(URL("http://dify.ai:12345/") / "api") == expected_2
expected_3 = 'https://dify.ai/api/v1'
assert str(URL('https://dify.ai') / 'api' / 'v1') == expected_3
assert str(URL('https://dify.ai') / 'api/v1') == expected_3
assert str(URL('https://dify.ai/') / 'api/v1') == expected_3
assert str(URL('https://dify.ai/api') / 'v1') == expected_3
assert str(URL('https://dify.ai/api/') / 'v1') == expected_3
expected_3 = "https://dify.ai/api/v1"
assert str(URL("https://dify.ai") / "api" / "v1") == expected_3
assert str(URL("https://dify.ai") / "api/v1") == expected_3
assert str(URL("https://dify.ai/") / "api/v1") == expected_3
assert str(URL("https://dify.ai/api") / "v1") == expected_3
assert str(URL("https://dify.ai/api/") / "v1") == expected_3
with pytest.raises(ValueError) as e1:
str(URL('https://dify.ai') / '/api')
str(URL("https://dify.ai") / "/api")
assert str(e1.value) == "Appending path '/api' starting from slash is forbidden"