Exemplo n.º 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"),
    ]
Exemplo n.º 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')
    ]
Exemplo n.º 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"),
         ]
Exemplo n.º 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'),
    ]
Exemplo n.º 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'),
    ]
Exemplo n.º 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"),
    ]
Exemplo n.º 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'),
                   ]
Exemplo n.º 8
0
def test_urllist_URL():
    assert urllist(URL('foo://localhost')) == [URL('foo://localhost')]
Exemplo n.º 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'),
    ]
Exemplo n.º 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'),
    ]
Exemplo n.º 11
0
def test_urllist_URL_no_scheme():
    assert urllist(URL('bar.com'), default_scheme='foo') == [
        URL('foo://bar.com'),
    ]
Exemplo n.º 12
0
def test_urllist_str():
    assert urllist('foo://localhost') == [URL('foo://localhost')]
Exemplo n.º 13
0
def test_urllist_empty_raises(value):
    with pytest.raises(ValueError):
        urllist(value)
Exemplo n.º 14
0
def test_urllist_str_no_scheme():
    assert urllist("bar.com", default_scheme="foo") == [URL("foo://bar.com")]
Exemplo n.º 15
0
 def broker_list(self, value: BrokerArg) -> List[_URL]:
     return urllist(value, default_scheme=self.default_scheme)
Exemplo n.º 16
0
def test_urllist_URL_no_scheme_scalar_arg():
    assert urllist(URL("bar.com"), default_scheme="foo") == [
        URL("foo://bar.com"),
    ]
Exemplo n.º 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"),
                   ]
Exemplo n.º 18
0
def test_urllist_URL():
    assert urllist(URL("foo://localhost")) == [URL("foo://localhost")]
Exemplo n.º 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"),
    ]
Exemplo n.º 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"),
    ]
Exemplo n.º 21
0
 def broker(self, broker: Union[URL, str, List[URL]]) -> None:
     self._broker = urllist(broker, default_scheme=DEFAULT_BROKER_SCHEME)
Exemplo n.º 22
0
def test_urllist_str():
    assert urllist("foo://localhost") == [URL("foo://localhost")]