Exemple #1
0
def test_urllist_list_of_strings():
    assert urllist([
        "kafka://kafka1.example.com:9092",
        "kafka://kafka2.example.com:9092",
    ]) == [
        URL("kafka://kafka1.example.com:9092"),
        URL("kafka://kafka2.example.com:9092"),
    ]
Exemple #2
0
def test_urllist_list_of_strings():
    assert urllist([
        'kafka://kafka1.example.com:9092',
        'kafka://kafka2.example.com:9092',
    ]) == [
        URL('kafka://kafka1.example.com:9092'),
        URL('kafka://kafka2.example.com:9092')
    ]
Exemple #3
0
def test_urllist_URLs():
    assert urllist(
        [URL("foo://localhost"),
         URL("bar.com"),
         URL("example.com")]) == [
             URL("foo://localhost"),
             URL("foo://bar.com"),
             URL("foo://example.com"),
         ]
Exemple #4
0
def test_urllist_URLs_no_scheme():
    assert urllist([
        URL('localhost'),
        URL('bar.com'),
        URL('example.com'),
    ], default_scheme='foo') == [
        URL('foo://localhost'),
        URL('foo://bar.com'),
        URL('foo://example.com'),
    ]
Exemple #5
0
def test_urllist_URLs():
    assert urllist([
        URL('foo://localhost'),
        URL('bar.com'),
        URL('example.com'),
    ]) == [
        URL('foo://localhost'),
        URL('foo://bar.com'),
        URL('foo://example.com'),
    ]
Exemple #6
0
def test_urllist_URLs_no_scheme():
    assert urllist(
        [
            URL("localhost"),
            URL("bar.com"),
            URL("example.com"),
        ],
        default_scheme="foo",
    ) == [
        URL("foo://localhost"),
        URL("foo://bar.com"),
        URL("foo://example.com"),
    ]
Exemple #7
0
def test_urllist_URL_no_scheme_list_arg():
    assert urllist([URL('bar.com'), URL('//localhost:9092')],
                   default_scheme='foo') == [
                       URL('foo://bar.com'),
                       URL('foo://localhost:9092'),
                   ]
Exemple #8
0
def test_urllist_URL():
    assert urllist(URL('foo://localhost')) == [URL('foo://localhost')]
Exemple #9
0
def test_urllist_strsep_no_scheme():
    assert urllist('localhost;bar.com;example.com', default_scheme='bar') == [
        URL('bar://localhost'),
        URL('bar://bar.com'),
        URL('bar://example.com'),
    ]
Exemple #10
0
def test_urllist_strsep():
    assert urllist('foo://localhost;bar.com;example.com') == [
        URL('foo://localhost'),
        URL('foo://bar.com'),
        URL('foo://example.com'),
    ]
Exemple #11
0
def test_urllist_URL_no_scheme():
    assert urllist(URL('bar.com'), default_scheme='foo') == [
        URL('foo://bar.com'),
    ]
Exemple #12
0
def test_urllist_str():
    assert urllist('foo://localhost') == [URL('foo://localhost')]
Exemple #13
0
def test_urllist_empty_raises(value):
    with pytest.raises(ValueError):
        urllist(value)
Exemple #14
0
def test_urllist_str_no_scheme():
    assert urllist("bar.com", default_scheme="foo") == [URL("foo://bar.com")]
Exemple #15
0
 def broker_list(self, value: BrokerArg) -> List[_URL]:
     return urllist(value, default_scheme=self.default_scheme)
Exemple #16
0
def test_urllist_URL_no_scheme_scalar_arg():
    assert urllist(URL("bar.com"), default_scheme="foo") == [
        URL("foo://bar.com"),
    ]
Exemple #17
0
def test_urllist_URL_no_scheme_list_arg():
    assert urllist([URL("bar.com"), URL("//localhost:9092")],
                   default_scheme="foo") == [
                       URL("foo://bar.com"),
                       URL("foo://localhost:9092"),
                   ]
Exemple #18
0
def test_urllist_URL():
    assert urllist(URL("foo://localhost")) == [URL("foo://localhost")]
Exemple #19
0
def test_urllist_strsep_no_scheme():
    assert urllist("localhost;bar.com;example.com", default_scheme="bar") == [
        URL("bar://localhost"),
        URL("bar://bar.com"),
        URL("bar://example.com"),
    ]
Exemple #20
0
def test_urllist_strsep():
    assert urllist("foo://localhost;bar.com;example.com") == [
        URL("foo://localhost"),
        URL("foo://bar.com"),
        URL("foo://example.com"),
    ]
Exemple #21
0
 def broker(self, broker: Union[URL, str, List[URL]]) -> None:
     self._broker = urllist(broker, default_scheme=DEFAULT_BROKER_SCHEME)
Exemple #22
0
def test_urllist_str():
    assert urllist("foo://localhost") == [URL("foo://localhost")]