Fix port and allow silence float could be int
This commit is contained in:
parent
0d99378f7d
commit
9a690f42dc
@ -2,10 +2,12 @@ import pytest
|
|||||||
import warnings
|
import warnings
|
||||||
from nucon import Nucon, NuconConfig, PumpStatus, PumpDryStatus, PumpOverloadStatus, BreakerStatus
|
from nucon import Nucon, NuconConfig, PumpStatus, PumpDryStatus, PumpOverloadStatus, BreakerStatus
|
||||||
|
|
||||||
|
WARN_FLOAT_COULD_BE_INT = False
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def nucon_setup():
|
def nucon_setup():
|
||||||
Nucon.set_dummy_mode(False) # Assume the game is running
|
Nucon.set_dummy_mode(False) # Assume the game is running
|
||||||
Nucon.set_base_url("http://localhost:8080/")
|
Nucon.set_base_url("http://localhost:8785/")
|
||||||
yield
|
yield
|
||||||
Nucon.set_dummy_mode(True)
|
Nucon.set_dummy_mode(True)
|
||||||
|
|
||||||
@ -14,7 +16,7 @@ def test_read_all_parameters(nucon_setup):
|
|||||||
assert len(all_params) == len(Nucon)
|
assert len(all_params) == len(Nucon)
|
||||||
for param, value in all_params.items():
|
for param, value in all_params.items():
|
||||||
assert isinstance(value, param.param_type), f"Parameter {param.name} has incorrect type. Expected {param.param_type}, got {type(value)}"
|
assert isinstance(value, param.param_type), f"Parameter {param.name} has incorrect type. Expected {param.param_type}, got {type(value)}"
|
||||||
if param.param_type == float and value.is_integer():
|
if param.param_type == float and value.is_integer() and WARN_FLOAT_COULD_BE_INT:
|
||||||
warnings.warn(f"Parameter {param.name} is a float but has an integer value: {value}")
|
warnings.warn(f"Parameter {param.name} is a float but has an integer value: {value}")
|
||||||
|
|
||||||
def test_write_writable_parameters(nucon_setup):
|
def test_write_writable_parameters(nucon_setup):
|
||||||
|
Loading…
Reference in New Issue
Block a user