btbricks 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- btbricks/__init__.py +52 -0
- btbricks/bt.py +1197 -0
- btbricks/bthub.py +218 -0
- btbricks/ctrl_plus.py +8 -0
- btbricks-0.2.1.dist-info/METADATA +232 -0
- btbricks-0.2.1.dist-info/RECORD +13 -0
- btbricks-0.2.1.dist-info/WHEEL +5 -0
- btbricks-0.2.1.dist-info/licenses/LICENSE +21 -0
- btbricks-0.2.1.dist-info/top_level.txt +2 -0
- tests/__init__.py +1 -0
- tests/test_bthub.py +102 -0
- tests/test_constants.py +77 -0
- tests/test_imports.py +94 -0
tests/test_imports.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Test that all public APIs can be imported."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_import_btbricks():
|
|
7
|
+
"""Test basic import of btbricks package."""
|
|
8
|
+
import btbricks
|
|
9
|
+
|
|
10
|
+
assert btbricks.__version__ == "0.1.0"
|
|
11
|
+
assert btbricks.__author__ == "Anton Vanhoucke"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_import_bt_module():
|
|
15
|
+
"""Test import of bt module classes."""
|
|
16
|
+
from btbricks import (
|
|
17
|
+
BLEHandler,
|
|
18
|
+
UARTCentral,
|
|
19
|
+
UARTPeripheral,
|
|
20
|
+
RCReceiver,
|
|
21
|
+
RCTransmitter,
|
|
22
|
+
MidiController,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
# Just check that classes exist
|
|
26
|
+
assert BLEHandler is not None
|
|
27
|
+
assert UARTCentral is not None
|
|
28
|
+
assert UARTPeripheral is not None
|
|
29
|
+
assert RCReceiver is not None
|
|
30
|
+
assert RCTransmitter is not None
|
|
31
|
+
assert MidiController is not None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_import_bthub():
|
|
35
|
+
"""Test import of BtHub class."""
|
|
36
|
+
from btbricks import BtHub
|
|
37
|
+
|
|
38
|
+
assert BtHub is not None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_import_control_constants():
|
|
42
|
+
"""Test import of control constants."""
|
|
43
|
+
from btbricks import (
|
|
44
|
+
R_STICK_HOR,
|
|
45
|
+
R_STICK_VER,
|
|
46
|
+
L_STICK_HOR,
|
|
47
|
+
L_STICK_VER,
|
|
48
|
+
BUTTONS,
|
|
49
|
+
L_TRIGGER,
|
|
50
|
+
R_TRIGGER,
|
|
51
|
+
SETTING1,
|
|
52
|
+
SETTING2,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Check that constants are defined
|
|
56
|
+
assert isinstance(R_STICK_HOR, int)
|
|
57
|
+
assert isinstance(R_STICK_VER, int)
|
|
58
|
+
assert isinstance(L_STICK_HOR, int)
|
|
59
|
+
assert isinstance(L_STICK_VER, int)
|
|
60
|
+
assert isinstance(BUTTONS, int)
|
|
61
|
+
assert isinstance(L_TRIGGER, int)
|
|
62
|
+
assert isinstance(R_TRIGGER, int)
|
|
63
|
+
assert isinstance(SETTING1, int)
|
|
64
|
+
assert isinstance(SETTING2, int)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_control_constants_unique():
|
|
68
|
+
"""Test that control constants have unique values."""
|
|
69
|
+
from btbricks import (
|
|
70
|
+
R_STICK_HOR,
|
|
71
|
+
R_STICK_VER,
|
|
72
|
+
L_STICK_HOR,
|
|
73
|
+
L_STICK_VER,
|
|
74
|
+
BUTTONS,
|
|
75
|
+
L_TRIGGER,
|
|
76
|
+
R_TRIGGER,
|
|
77
|
+
SETTING1,
|
|
78
|
+
SETTING2,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
constants = [
|
|
82
|
+
R_STICK_HOR,
|
|
83
|
+
R_STICK_VER,
|
|
84
|
+
L_STICK_HOR,
|
|
85
|
+
L_STICK_VER,
|
|
86
|
+
BUTTONS,
|
|
87
|
+
L_TRIGGER,
|
|
88
|
+
R_TRIGGER,
|
|
89
|
+
SETTING1,
|
|
90
|
+
SETTING2,
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
# All constants should be unique
|
|
94
|
+
assert len(constants) == len(set(constants))
|