-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add higher-level function for firmware version
Closes #128
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
"""Test suite for LuxtronikData""" | ||
|
||
from luxtronik import LuxtronikData, Parameters, Calculations, Visibilities | ||
|
||
|
||
class TestLuxtronikData: | ||
"""Test suite for LuxtronikData datatype""" | ||
|
||
def test_init(self): | ||
"""Test cases for __init__""" | ||
|
||
a = LuxtronikData() | ||
assert a.parameters.safe | ||
|
||
b = LuxtronikData(safe=False) | ||
assert not b.parameters.safe | ||
|
||
para = Parameters() | ||
c = LuxtronikData(para) | ||
assert c.parameters == para | ||
assert a.parameters != para | ||
|
||
calc = Calculations() | ||
visi = Visibilities() | ||
d = LuxtronikData(calculations=calc, visibilities=visi) | ||
assert d.calculations == calc | ||
assert d.visibilities == visi | ||
assert c.calculations != calc | ||
assert c.visibilities != visi | ||
|
||
def test_get_firmware_version(self): | ||
"""Test cases for get_firmware_version()""" | ||
|
||
a = LuxtronikData() | ||
for i in range(81, 91): | ||
a.calculations.get(i).raw = 0 | ||
assert a.get_firmware_version() == "" | ||
|
||
a.calculations.get(81).raw = ord("V") | ||
assert a.get_firmware_version() == "V" | ||
|
||
a.calculations.get(82).raw = ord("3") | ||
assert a.get_firmware_version() == "V3" | ||
|
||
a.calculations.get(83).raw = ord(".") | ||
assert a.get_firmware_version() == "V3." | ||
|
||
a.calculations.get(84).raw = ord("1") | ||
assert a.get_firmware_version() == "V3.1" |