Privatize methods & renames
This commit is contained in:
@@ -282,7 +282,7 @@ class MockInstructionPacket(MockDynamixelPacketv2):
|
||||
"""
|
||||
data = []
|
||||
for idx, value in ids_values.items():
|
||||
split_value = DynamixelMotorsBus.split_int_bytes(value, data_length)
|
||||
split_value = DynamixelMotorsBus._split_int_to_bytes(value, data_length)
|
||||
data += [idx, *split_value]
|
||||
params = [
|
||||
dxl.DXL_LOBYTE(start_address),
|
||||
@@ -319,7 +319,7 @@ class MockInstructionPacket(MockDynamixelPacketv2):
|
||||
+2 is for the length bytes,
|
||||
+2 is for the CRC at the end.
|
||||
"""
|
||||
data = DynamixelMotorsBus.split_int_bytes(value, data_length)
|
||||
data = DynamixelMotorsBus._split_int_to_bytes(value, data_length)
|
||||
params = [
|
||||
dxl.DXL_LOBYTE(start_address),
|
||||
dxl.DXL_HIBYTE(start_address),
|
||||
|
||||
@@ -149,7 +149,7 @@ class MockInstructionPacket(MockFeetechPacket):
|
||||
"""
|
||||
data = []
|
||||
for idx, value in ids_values.items():
|
||||
split_value = FeetechMotorsBus.split_int_bytes(value, data_length)
|
||||
split_value = FeetechMotorsBus._split_int_to_bytes(value, data_length)
|
||||
data += [idx, *split_value]
|
||||
params = [start_address, data_length, *data]
|
||||
length = len(ids_values) * (1 + data_length) + 4
|
||||
@@ -179,7 +179,7 @@ class MockInstructionPacket(MockFeetechPacket):
|
||||
+1 is for the length bytes,
|
||||
+1 is for the checksum at the end.
|
||||
"""
|
||||
data = FeetechMotorsBus.split_int_bytes(value, data_length)
|
||||
data = FeetechMotorsBus._split_int_to_bytes(value, data_length)
|
||||
params = [start_address, *data]
|
||||
length = data_length + 3
|
||||
return cls.build(scs_id=scs_id, params=params, length=length, instruct_type="Write")
|
||||
|
||||
@@ -67,24 +67,24 @@ def test_autouse_patch():
|
||||
"max four bytes",
|
||||
],
|
||||
) # fmt: skip
|
||||
def test_split_int_bytes(value, n_bytes, expected):
|
||||
assert DynamixelMotorsBus.split_int_bytes(value, n_bytes) == expected
|
||||
def test_split_int_to_bytes(value, n_bytes, expected):
|
||||
assert DynamixelMotorsBus._split_int_to_bytes(value, n_bytes) == expected
|
||||
|
||||
|
||||
def test_split_int_bytes_invalid_n_bytes():
|
||||
def test_split_int_to_bytes_invalid_n_bytes():
|
||||
with pytest.raises(NotImplementedError):
|
||||
DynamixelMotorsBus.split_int_bytes(100, 3)
|
||||
DynamixelMotorsBus._split_int_to_bytes(100, 3)
|
||||
|
||||
|
||||
def test_split_int_bytes_negative_numbers():
|
||||
def test_split_int_to_bytes_negative_numbers():
|
||||
with pytest.raises(ValueError):
|
||||
neg = DynamixelMotorsBus.split_int_bytes(-1, 1)
|
||||
neg = DynamixelMotorsBus._split_int_to_bytes(-1, 1)
|
||||
print(neg)
|
||||
|
||||
|
||||
def test_split_int_bytes_large_number():
|
||||
def test_split_int_to_bytes_large_number():
|
||||
with pytest.raises(ValueError):
|
||||
DynamixelMotorsBus.split_int_bytes(2**32, 4) # 4-byte max is 0xFFFFFFFF
|
||||
DynamixelMotorsBus._split_int_to_bytes(2**32, 4) # 4-byte max is 0xFFFFFFFF
|
||||
|
||||
|
||||
def test_abc_implementation(dummy_motors):
|
||||
|
||||
@@ -67,24 +67,24 @@ def test_autouse_patch():
|
||||
"max four bytes",
|
||||
],
|
||||
) # fmt: skip
|
||||
def test_split_int_bytes(value, n_bytes, expected):
|
||||
assert FeetechMotorsBus.split_int_bytes(value, n_bytes) == expected
|
||||
def test_split_int_to_bytes(value, n_bytes, expected):
|
||||
assert FeetechMotorsBus._split_int_to_bytes(value, n_bytes) == expected
|
||||
|
||||
|
||||
def test_split_int_bytes_invalid_n_bytes():
|
||||
def test_split_int_to_bytes_invalid_n_bytes():
|
||||
with pytest.raises(NotImplementedError):
|
||||
FeetechMotorsBus.split_int_bytes(100, 3)
|
||||
FeetechMotorsBus._split_int_to_bytes(100, 3)
|
||||
|
||||
|
||||
def test_split_int_bytes_negative_numbers():
|
||||
def test_split_int_to_bytes_negative_numbers():
|
||||
with pytest.raises(ValueError):
|
||||
neg = FeetechMotorsBus.split_int_bytes(-1, 1)
|
||||
neg = FeetechMotorsBus._split_int_to_bytes(-1, 1)
|
||||
print(neg)
|
||||
|
||||
|
||||
def test_split_int_bytes_large_number():
|
||||
def test_split_int_to_bytes_large_number():
|
||||
with pytest.raises(ValueError):
|
||||
FeetechMotorsBus.split_int_bytes(2**32, 4) # 4-byte max is 0xFFFFFFFF
|
||||
FeetechMotorsBus._split_int_to_bytes(2**32, 4) # 4-byte max is 0xFFFFFFFF
|
||||
|
||||
|
||||
def test_abc_implementation(dummy_motors):
|
||||
|
||||
Reference in New Issue
Block a user