lib.Uri.query: Add property
lib.Uri doesn't support query strings, and this commit adds support: Expose the query as a property, keep it through the path replacement methods, and show it in the full forms. Signed-off-by: Jan Lindemann <jan@janware.com> Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.4.0
This commit is contained in:
parent
bd13d053e0
commit
d6f622e000
1 changed files with 58 additions and 24 deletions
|
|
@ -96,4 +96,17 @@ assert u.to_string == 'ssh://user:pass@host:22/path'
|
|||
u = Uri('https://user:secret@example.com/repo.git')
|
||||
assert '<hidden>' in str(u)
|
||||
|
||||
# The query is identity, not path: it is exposed, it survives a
|
||||
# path change, and it shows in the full form
|
||||
u = Uri('kvfile://host/?pkg-filter=url=~jw.dev')
|
||||
assert u.query == 'pkg-filter=url=~jw.dev'
|
||||
assert u.path == '/'
|
||||
assert u.new_replace_path('etc/foo.conf').to_string == \
|
||||
'kvfile://host/etc/foo.conf?pkg-filter=url=~jw.dev'
|
||||
u = Uri('kvfile:///?pkg-filter=url=~jw.dev')
|
||||
assert u.new_replace_path('etc').to_string == \
|
||||
'kvfile:///etc?pkg-filter=url=~jw.dev'
|
||||
assert 'pkg-filter=url=~jw.dev' in u.full
|
||||
assert Uri('ssh://host/path').query == ''
|
||||
|
||||
print('All Uri tests passed')
|
||||
|
|
|
|||
Loading…
Reference in a new issue