Skip to content

Commit 6c378cc

Browse files
authored
Fix issue/28 (adamcharnock#29)
* added test for reading to json and fix serialisation of scalefactor which is now a field not an int * version bump
1 parent 4074f74 commit 6c378cc

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

mate3/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def read(client, args):
4747
for value in device.fields([Mode.R, Mode.RW]):
4848
values[value.field.name] = {
4949
"implemented": value.implemented,
50-
"scale_factor": value.scale_factor,
50+
"scale_factor": value.scale_factor.value if value.scale_factor is not None else None,
5151
"raw_value": value.raw_value
5252
if value.raw_value is None or isinstance(value.raw_value, (str, int, float))
5353
else repr(value.raw_value),

mate3/tests/test_cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
CACHE_PATH = Path(__file__).parent / "known_systems" / "chinezbrun" / "modbus.json"
44

55

6-
def test_read(script_runner):
6+
def test_read_txt(script_runner):
77
ret = script_runner.run("mate3", "read", f"--cache-path={CACHE_PATH}", "--cache-only")
88
assert ret.success
99

1010

11+
def test_read_json(script_runner):
12+
ret = script_runner.run("mate3", "read", f"--cache-path={CACHE_PATH}", "--cache-only", "--format", "json")
13+
assert ret.success
14+
15+
1116
def test_devices(script_runner):
1217
ret = script_runner.run("mate3", "devices", f"--cache-path={CACHE_PATH}", "--cache-only")
1318
assert ret.success

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ to = {format = "setuppy", path = "setup.py"}
55
[tool.poetry]
66
name = "mate3"
77
readme = "README.md"
8-
version = "0.6.1"
8+
version = "0.6.2"
99
description = "Outback Mate3s Python Library"
1010
authors = ["Adam Charnock <[email protected]>", "kodonnell <[email protected]>"]
1111
homepage = "https://github.com/adamcharnock/mate3/"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
setup(
2525
long_description=readme,
2626
name='mate3',
27-
version='0.6.1',
27+
version='0.6.2',
2828
description='Outback Mate3s Python Library',
2929
python_requires='==3.*,>=3.7.0',
3030
project_urls={"homepage": "https://github.com/adamcharnock/mate3/", "repository": "https://github.com/adamcharnock/mate3/"},

0 commit comments

Comments
 (0)