makcu 0.2.0__py3-none-any.whl → 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.
makcu/test_suite.py CHANGED
@@ -2,34 +2,29 @@ import pytest
2
2
  import time
3
3
  from makcu import MouseButton
4
4
 
5
- # Pre-compute test data to avoid runtime overhead
5
+
6
6
  TEST_BUTTONS = (MouseButton.LEFT, MouseButton.RIGHT, MouseButton.MIDDLE)
7
7
  BUTTON_STATE_KEYS = ('left', 'right', 'middle', 'mouse4', 'mouse5')
8
8
  MOVE_COORDS = ((10, 0), (0, 10), (-10, 0), (0, -10))
9
9
 
10
10
  def test_connect_to_port(makcu):
11
- """Test connection - already connected via fixture"""
12
11
  print("Connecting to port...")
13
12
  makcu.connect()
14
13
  assert makcu.is_connected(), "Failed to connect to the makcu"
15
14
 
16
15
  def test_press_and_release(makcu):
17
- """Test basic press/release - minimal overhead"""
18
16
  makcu.press(MouseButton.LEFT)
19
17
  makcu.release(MouseButton.LEFT)
20
18
 
21
19
  def test_firmware_version(makcu):
22
- """Test firmware version retrieval"""
23
20
  version = makcu.mouse.get_firmware_version()
24
21
  assert version and len(version.strip()) > 0
25
22
 
26
23
  def test_middle_click(makcu):
27
- """Test middle button - direct operations"""
28
24
  makcu.press(MouseButton.MIDDLE)
29
25
  makcu.release(MouseButton.MIDDLE)
30
26
 
31
27
  def test_device_info(makcu):
32
- """Test device info - optimized checks"""
33
28
  print("Fetching device info...")
34
29
  info = makcu.mouse.get_device_info()
35
30
  print(f"Device Info: {info}")
@@ -37,25 +32,21 @@ def test_device_info(makcu):
37
32
  assert info.get("isConnected") is True
38
33
 
39
34
  def test_port_connection(makcu):
40
- """Test connection state - cached check"""
41
35
  assert makcu.is_connected()
42
36
 
43
37
  def test_button_mask(makcu):
44
- """Test button mask - direct integer check"""
45
38
  print("Getting button mask...")
46
39
  mask = makcu.get_button_mask()
47
40
  print(f"Mask value: {mask}")
48
41
  assert isinstance(mask, int)
49
42
 
50
43
  def test_get_button_states(makcu):
51
- """Test button states - optimized validation"""
52
44
  states = makcu.get_button_states()
53
45
  assert isinstance(states, dict)
54
46
  for key in BUTTON_STATE_KEYS:
55
47
  assert key in states
56
48
 
57
49
  def test_lock_state(makcu):
58
- """Test lock functionality - minimal operations"""
59
50
  print("Locking LEFT button...")
60
51
  makcu.lock_left(True)
61
52
  print("Querying lock state while LEFT is locked...")
@@ -64,18 +55,16 @@ def test_lock_state(makcu):
64
55
  assert state
65
56
 
66
57
  def test_makcu_behavior(makcu):
67
- """Test basic behavior - batched operations"""
68
58
  makcu.move(25, 25)
69
59
  makcu.click(MouseButton.LEFT)
70
60
  makcu.scroll(-2)
71
61
 
72
62
  def test_batch_commands(makcu):
73
- """Test batch execution performance"""
74
63
  print("Testing batch command execution (10 commands)...")
75
64
 
76
65
  start_time = time.perf_counter()
77
66
 
78
- # Execute 10 different commands in rapid succession
67
+
79
68
  makcu.move(10, 0)
80
69
  makcu.click(MouseButton.LEFT)
81
70
  makcu.move(0, 10)
@@ -93,10 +82,10 @@ def test_batch_commands(makcu):
93
82
  print(f"Batch execution time: {elapsed_ms:.2f}ms")
94
83
  print(f"Average per command: {elapsed_ms/10:.2f}ms")
95
84
 
96
- # Assert that 10 commands complete in under 50ms
85
+
97
86
  assert elapsed_ms < 50, f"Batch commands took {elapsed_ms:.2f}ms, expected < 50ms"
98
87
 
99
- # Also test with mouse movements only
88
+
100
89
  start_time = time.perf_counter()
101
90
  for _ in range(10):
102
91
  makcu.move(5, 5)
@@ -106,10 +95,9 @@ def test_batch_commands(makcu):
106
95
  print(f"10 move commands: {move_only_ms:.2f}ms ({move_only_ms/10:.2f}ms per move)")
107
96
 
108
97
  def test_rapid_moves(makcu):
109
- """Test rapid movement commands"""
110
98
  start = time.perf_counter_ns()
111
99
 
112
- # Unrolled loop for 10 moves
100
+
113
101
  makcu.move(5, 5)
114
102
  makcu.move(5, 5)
115
103
  makcu.move(5, 5)
@@ -126,10 +114,9 @@ def test_rapid_moves(makcu):
126
114
  assert elapsed_ms < 30
127
115
 
128
116
  def test_button_performance(makcu):
129
- """Test button operation performance"""
130
117
  start = time.perf_counter_ns()
131
118
 
132
- # Test each button type once
119
+
133
120
  for button in TEST_BUTTONS:
134
121
  makcu.press(button)
135
122
  makcu.release(button)
@@ -139,10 +126,9 @@ def test_button_performance(makcu):
139
126
  assert elapsed_ms < 20
140
127
 
141
128
  def test_mixed_operations(makcu):
142
- """Test mixed operation performance"""
143
129
  start = time.perf_counter_ns()
144
130
 
145
- # Mixed operations without loops
131
+
146
132
  makcu.move(20, 20)
147
133
  makcu.press(MouseButton.LEFT)
148
134
  makcu.move(-20, -20)
@@ -153,7 +139,7 @@ def test_mixed_operations(makcu):
153
139
  print(f"Mixed operations: {elapsed_ms:.2f}ms")
154
140
  assert elapsed_ms < 15
155
141
 
156
- # Skip slow/unnecessary tests
142
+
157
143
  @pytest.mark.skip(reason="Capture test disabled until firmware supports tracking clicks from software input")
158
144
  def test_capture_right_clicks(makcu):
159
145
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makcu
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Python library for Makcu hardware device control
5
5
  Author: SleepyTotem
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -0,0 +1,16 @@
1
+ makcu/__init__.py,sha256=HyjxvhE5feNyh4ZMY5U0U_X-7BzltSh_gOsX_o5mSLA,1745
2
+ makcu/__main__.py,sha256=6D21UxHHEd1USLo5CLsGAm3i-HPmZ_j7BBjHbUer3Zg,11097
3
+ makcu/conftest.py,sha256=t4ZP5WeZv-lgfplgbwojiJWQXeuYASU9jNDRrsSX2V4,863
4
+ makcu/connection.py,sha256=Xz8KsfhPu2S3KfRnoeASM-6gmfRZklME5MQjaRawrjk,15193
5
+ makcu/controller.py,sha256=kxHGtGZTE4JHZozZeRaet_AXK-69LZG_ZP6ZPg8gqjw,13064
6
+ makcu/enums.py,sha256=VmvCLmpghVHuTAkvCGMfA14MgWTtFVMfsGQQNnJ58Ts,126
7
+ makcu/errors.py,sha256=X_eWPKkVgcyryT6-_7jjVkcHKtrAZAsarbfMRpIcz58,242
8
+ makcu/makcu.pyi,sha256=a8_vQ43MAqVxcASQiCHoYYG_LkfM5NEBAab5dgxcVK4,424
9
+ makcu/mouse.py,sha256=d-6wcRrNgfLE6QQ26YLbQj-u4EaGAMXn0bVsb0cncoM,8442
10
+ makcu/py.typed,sha256=lI_IPBO6A6a5eY5kRQDNsdSydUb3sFWtcC_ML8FNftU,111
11
+ makcu/test_suite.py,sha256=7Rsq5sKeR4zvCMTNZDv6TCYMKs7B3EVTuwyIDgHfdk8,4092
12
+ makcu-0.2.1.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
13
+ makcu-0.2.1.dist-info/METADATA,sha256=uHpFIqMrVUFtti2luLjVpH2mqSl2uwQ5a39FeAPJwRs,55161
14
+ makcu-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ makcu-0.2.1.dist-info/top_level.txt,sha256=IRO1UVb5LK_ovjau0g4oObyXQqy00tVEE-yF5lPgw1w,6
16
+ makcu-0.2.1.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- makcu/__init__.py,sha256=_uWl1sH4M9_NFKUPZAeq3A9np-6nZwSUOX_hJVv9Wck,2111
2
- makcu/__main__.py,sha256=kJu5wuuMrHxTcESUEEGxuDHcd71RdRygDSoydxfW9ug,12063
3
- makcu/conftest.py,sha256=OsGIlt593H8AzY5BhCHHW8BmjD1yc1z2wqvyZvFiUdk,936
4
- makcu/connection.py,sha256=57VerGwpGZVhuLlAgs2HAHl1RHI9hGa8OBImv2GmDr8,18331
5
- makcu/controller.py,sha256=LeRxbPT69_rrS7C8moNXKy9AdCGq0Le9exM2g-Y3jmU,15758
6
- makcu/enums.py,sha256=VmvCLmpghVHuTAkvCGMfA14MgWTtFVMfsGQQNnJ58Ts,126
7
- makcu/errors.py,sha256=4CkQ4gKa7GL5-BO3yOAJMMsy3QlUDDL42S1P1clqV4A,562
8
- makcu/makcu.pyi,sha256=a8_vQ43MAqVxcASQiCHoYYG_LkfM5NEBAab5dgxcVK4,424
9
- makcu/mouse.py,sha256=pdHU4oqfmD1OzQLBbcIvJt9U9fLVQMYUBJKip_N8vPw,10083
10
- makcu/py.typed,sha256=lI_IPBO6A6a5eY5kRQDNsdSydUb3sFWtcC_ML8FNftU,111
11
- makcu/test_suite.py,sha256=cUhmP3_wniANiV1B5xGu7n3WHaBj3zsQBxcOW5LPRtY,5105
12
- makcu-0.2.0.dist-info/licenses/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
13
- makcu-0.2.0.dist-info/METADATA,sha256=msDAfKdpsWtJO-WqPxg87GZds2Rgjct7wE0AkI_2dQg,55161
14
- makcu-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- makcu-0.2.0.dist-info/top_level.txt,sha256=IRO1UVb5LK_ovjau0g4oObyXQqy00tVEE-yF5lPgw1w,6
16
- makcu-0.2.0.dist-info/RECORD,,
File without changes