File: test_exports.py

package info (click to toggle)
python-websockets 15.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,948 kB
  • sloc: python: 25,105; javascript: 350; ansic: 148; makefile: 43
file content (46 lines) | stat: -rw-r--r-- 1,230 bytes parent folder | download
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
34
35
36
37
38
39
40
41
42
43
44
45
46
import unittest

import websockets
import websockets.asyncio.client
import websockets.asyncio.router
import websockets.asyncio.server
import websockets.client
import websockets.datastructures
import websockets.exceptions
import websockets.server
import websockets.typing
import websockets.uri


combined_exports = [
    name
    for name in (
        []
        + websockets.asyncio.client.__all__
        + websockets.asyncio.router.__all__
        + websockets.asyncio.server.__all__
        + websockets.client.__all__
        + websockets.datastructures.__all__
        + websockets.exceptions.__all__
        + websockets.frames.__all__
        + websockets.http11.__all__
        + websockets.protocol.__all__
        + websockets.server.__all__
        + websockets.typing.__all__
    )
    if not name.isupper()  # filter out constants
]


class ExportsTests(unittest.TestCase):
    def test_top_level_module_reexports_submodule_exports(self):
        self.assertEqual(
            set(combined_exports),
            set(websockets.__all__),
        )

    def test_submodule_exports_are_globally_unique(self):
        self.assertEqual(
            len(set(combined_exports)),
            len(combined_exports),
        )