Skip to content

Commit

Permalink
test: intial testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rokam committed May 15, 2024
1 parent f1e17d8 commit 9a929b3
Show file tree
Hide file tree
Showing 83 changed files with 85 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@
},
"remoteUser": "root",
"containerUser": "vscode",
"postAttachCommand": "pip3 install --user -r requirements.txt"
"postAttachCommand": ["pip3 install --user -r requirements.txt"]
}
19 changes: 19 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Install requirements.txt",
"type": "shell",
"command": "pip3 install --user -r requirements.txt",
"problemMatcher": []
},
{
"label": "Build and install midealocal lib",
"type": "shell",
"command": "python3 -m build && pip3 install dist/midea_local*.whl",
"problemMatcher": []
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ pytest
ruff
aiohttp
ifaddr
pycryptodome
pycryptodome
build
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
long_description_content_type="text/markdown",
url="https://github.com/rokam/midea-local",
install_requires=requires,
packages=setuptools.find_packages(exclude=["tests", "tests.*"]),
packages=setuptools.find_packages(
include=["midealocal", "midealocal.*"], exclude=["tests", "tests.*"]
),
python_requires=">=3.10",
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
60 changes: 60 additions & 0 deletions tests/crc8_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""CRC8 Test"""

from midealocal.crc8 import calculate


def test_calculate() -> None:
"""Test calculate method."""
data: bytearray = bytearray(
[
# 2 bytes - StaicHeader
0x5A,
0x5A,
# 2 bytes - mMessageType
0x01,
0x11,
# 2 bytes - PacketLenght
0x00,
0x00,
# 2 bytes
0x20,
0x00,
# 4 bytes - MessageId
0x00,
0x00,
0x00,
0x00,
# 8 bytes - Date&Time
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
# 6 bytes - mDeviceID
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
# 12 bytes
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
]
)
assert calculate(data) == 86

0 comments on commit 9a929b3

Please sign in to comment.