| 1 |
import unittest |
| 2 |
|
| 3 |
import websockets |
| 4 |
import websockets.asyncio.client |
| 5 |
import websockets.asyncio.router |
| 6 |
import websockets.asyncio.server |
| 7 |
import websockets.client |
| 8 |
import websockets.datastructures |
| 9 |
import websockets.exceptions |
| 10 |
import websockets.server |
| 11 |
import websockets.typing |
| 12 |
import websockets.uri |
| 13 |
|
| 14 |
|
| 15 |
combined_exports = [ |
| 16 |
name |
| 17 |
for name in ( |
| 18 |
[] |
| 19 |
+ websockets.asyncio.client.__all__ |
| 20 |
+ websockets.asyncio.router.__all__ |
| 21 |
+ websockets.asyncio.server.__all__ |
| 22 |
+ websockets.client.__all__ |
| 23 |
+ websockets.datastructures.__all__ |
| 24 |
+ websockets.exceptions.__all__ |
| 25 |
+ websockets.frames.__all__ |
| 26 |
+ websockets.http11.__all__ |
| 27 |
+ websockets.protocol.__all__ |
| 28 |
+ websockets.server.__all__ |
| 29 |
+ websockets.typing.__all__ |
| 30 |
) |
| 31 |
if not name.isupper() # filter out constants |
| 32 |
] |
| 33 |
|
| 34 |
|
| 35 |
class ExportsTests(unittest.TestCase): |
| 36 |
def test_top_level_module_reexports_submodule_exports(self): |
| 37 |
self.assertEqual( |
| 38 |
set(combined_exports), |
| 39 |
set(websockets.__all__), |
| 40 |
) |
| 41 |
|
| 42 |
def test_submodule_exports_are_globally_unique(self): |
| 43 |
self.assertEqual( |
| 44 |
len(set(combined_exports)), |
| 45 |
len(combined_exports), |
| 46 |
) |