/usr/lib/python3/dist-packages/websockets/test_uri.py is in python3-websockets 3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import unittest
from .exceptions import InvalidURI
from .uri import *
VALID_URIS = [
('ws://localhost/', (False, 'localhost', 80, '/')),
('wss://localhost/', (True, 'localhost', 443, '/')),
('ws://localhost/path?query', (False, 'localhost', 80, '/path?query')),
('WS://LOCALHOST/PATH?QUERY', (False, 'localhost', 80, '/PATH?QUERY')),
]
INVALID_URIS = [
'http://localhost/',
'https://localhost/',
'ws://localhost/path#fragment',
'ws://user:pass@localhost/',
]
class URITests(unittest.TestCase):
def test_success(self):
for uri, parsed in VALID_URIS:
# wrap in `with self.subTest():` when dropping Python 3.3
self.assertEqual(parse_uri(uri), parsed)
def test_error(self):
for uri in INVALID_URIS:
# wrap in `with self.subTest():` when dropping Python 3.3
with self.assertRaises(InvalidURI):
parse_uri(uri)
|