File: test_address.py

package info (click to toggle)
python-parsl 2025.01.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,072 kB
  • sloc: python: 23,817; makefile: 349; sh: 276; ansic: 45
file content (20 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import pytest

from parsl.addresses import tcp_url


@pytest.mark.local
@pytest.mark.parametrize("address, port,expected", [
    ("127.0.0.1", 55001, "tcp://127.0.0.1:55001"),
    ("127.0.0.1", "55001", "tcp://127.0.0.1:55001"),
    ("127.0.0.1", None, "tcp://127.0.0.1"),
    ("::1", "55001", "tcp://[::1]:55001"),
    ("::ffff:127.0.0.1", 55001, "tcp://[::ffff:127.0.0.1]:55001"),
    ("::ffff:127.0.0.1", None, "tcp://::ffff:127.0.0.1"),
    ("::ffff:127.0.0.1", None, "tcp://::ffff:127.0.0.1"),
    ("*", None, "tcp://*"),
])
def test_tcp_url(address, port, expected):
    """Confirm valid address generation"""
    result = tcp_url(address, port)
    assert result == expected