コード例 #1
0
def test_constructor():
	#                 name       description        mode  cmd bytes decoder
	cmd = OBDCommand("Test", "example OBD command", "01", "23", 2, noop)
	assert cmd.name      == "Test"
	assert cmd.desc      == "example OBD command"
	assert cmd.mode      == "01"
	assert cmd.pid       == "23"
	assert cmd.bytes     == 2
	assert cmd.decode    == noop
	assert cmd.supported == False

	assert cmd.get_command()  == "0123"
	assert cmd.get_mode_int() == 1
	assert cmd.get_pid_int()  == 35

	cmd = OBDCommand("Test", "example OBD command", "01", "23", 2, noop, True)
	assert cmd.supported == True
コード例 #2
0
ファイル: test_OBDCommand.py プロジェクト: tlever/python-OBD
def test_constructor():
	#                 name       description        mode  cmd bytes decoder
	cmd = OBDCommand("Test", "example OBD command", "01", "23", 2, noop)
	assert cmd.name      == "Test"
	assert cmd.desc      == "example OBD command"
	assert cmd.mode      == "01"
	assert cmd.pid       == "23"
	assert cmd.bytes     == 2
	assert cmd.decode    == noop
	assert cmd.supported == False

	assert cmd.get_command()  == "0123"
	assert cmd.get_mode_int() == 1
	assert cmd.get_pid_int()  == 35

	cmd = OBDCommand("Test", "example OBD command", "01", "23", 2, noop, True)
	assert cmd.supported == True
コード例 #3
0
ファイル: test_OBDCommand.py プロジェクト: tlever/python-OBD
def test_get_pid_int():
	cmd = OBDCommand("", "", "01", "23", 4, noop)
	assert cmd.get_pid_int() == 0x23

	cmd = OBDCommand("", "", "01", "", 4, noop)
	assert cmd.get_pid_int() == 0