summaryrefslogtreecommitdiffstats
path: root/lang/python/python-zeroconf/test.sh
blob: 678854f4938e934b25dab23ec24d62584dca61c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

[ "$1" = python3-zeroconf ] || exit 0

python3 - << 'EOF'
from zeroconf import Zeroconf, ServiceInfo, ServiceBrowser
import socket

# Verify core classes are importable and instantiable
info = ServiceInfo(
    "_http._tcp.local.",
    "Test._http._tcp.local.",
    addresses=[socket.inet_aton("127.0.0.1")],
    port=80,
)
assert info.port == 80
assert info.type == "_http._tcp.local."

print("python3-zeroconf OK")
EOF