From 5e17ce0a0b417bf3bfcd39966a9487e087825d83 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Fri, 30 Oct 2020 10:40:46 -0400 Subject: [PATCH] minor fixup --- lbry/schema/url.py | 2 +- tests/unit/schema/test_url.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lbry/schema/url.py b/lbry/schema/url.py index 3b58bf74c..c869d2fc7 100644 --- a/lbry/schema/url.py +++ b/lbry/schema/url.py @@ -3,7 +3,7 @@ import unicodedata from typing import NamedTuple, Tuple -def _create_url_regex(legacy=False): +def _create_url_regex(): # see https://spec.lbry.com/ and test_url.py invalid_names_regex = \ r"[^=&#:$@%*?;\"/\\<>%{}|^~`\[\]" \ diff --git a/tests/unit/schema/test_url.py b/tests/unit/schema/test_url.py index 01d99768e..d0e322ea9 100644 --- a/tests/unit/schema/test_url.py +++ b/tests/unit/schema/test_url.py @@ -13,7 +13,6 @@ class TestURLParsing(unittest.TestCase): def _assert_url(self, url_string, strictly=True, **kwargs): url = URL.parse(url_string) - if strictly: if url_string.startswith('lbry://'): self.assertEqual(url_string, str(url)) @@ -46,23 +45,23 @@ class TestURLParsing(unittest.TestCase): url('test', stream_name='test') url('test*1', stream_name='test', stream_sequence='1') url('test$1', stream_name='test', stream_amount_order='1') + url(f'test#{claim_id}', stream_name='test', stream_claim_id=claim_id, strictly=False) url(f'test:{claim_id}', stream_name='test', stream_claim_id=claim_id) # channel url('@test', channel_name='@test') url('@test*1', channel_name='@test', channel_sequence='1') url('@test$1', channel_name='@test', channel_amount_order='1') + url(f'@test#{claim_id}', channel_name='@test', channel_claim_id=claim_id, strictly=False) url(f'@test:{claim_id}', channel_name='@test', channel_claim_id=claim_id) # channel/stream url('lbry://@test/stuff', channel_name='@test', stream_name='stuff') url('lbry://@test*1/stuff', channel_name='@test', channel_sequence='1', stream_name='stuff') url('lbry://@test$1/stuff', channel_name='@test', channel_amount_order='1', stream_name='stuff') + url(f'lbry://@test#{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff', strictly=False) url(f'lbry://@test:{claim_id}/stuff', channel_name='@test', channel_claim_id=claim_id, stream_name='stuff') - # legacy/new conversions - url(f'test#{claim_id}', stream_name='test', stream_claim_id=claim_id, strictly=False) - url('@test:1/stuff#2', channel_claim_id='1', stream_claim_id='2', - channel_name='@test', stream_name='stuff', strictly=False) - url('@test*1/stuff#2', channel_sequence='1', stream_claim_id='2', - channel_name='@test', stream_name='stuff', strictly=False) + # combined legacy and new + url('@test:1/stuff#2', channel_claim_id='1', stream_claim_id='2', channel_name='@test', stream_name='stuff', strictly=False) + url('@test*1/stuff#2', channel_sequence='1', stream_claim_id='2', channel_name='@test', stream_name='stuff', strictly=False) # unicode regex edges _url = lambda name: url(name, stream_name=name) _url('\uD799')