fix some flake8 warnings
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -16,7 +16,7 @@
|
|||||||
"python.testing.unittestEnabled": false,
|
"python.testing.unittestEnabled": false,
|
||||||
"python.testing.pytestEnabled": true,
|
"python.testing.pytestEnabled": true,
|
||||||
"flake8.args": [
|
"flake8.args": [
|
||||||
"--extend-exclude=app/tests/*.py system_tests/*.py ha_addons/ha_addon/tests/*.py"
|
"--extend-exclude=app/tests/*.py,system_tests/*.py,ha_addons/ha_addon/tests/*.py"
|
||||||
],
|
],
|
||||||
"sonarlint.connectedMode.project": {
|
"sonarlint.connectedMode.project": {
|
||||||
"connectionId": "s-allius",
|
"connectionId": "s-allius",
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ from home.create_config_toml import create_config
|
|||||||
from test_config import ConfigComplete, ConfigMinimum
|
from test_config import ConfigComplete, ConfigMinimum
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class FakeBuffer:
|
class FakeBuffer:
|
||||||
rd = bytearray()
|
rd = bytearray()
|
||||||
wr = str()
|
wr = str()
|
||||||
@@ -53,6 +52,7 @@ def patch_open():
|
|||||||
with patch('builtins.open', new_open) as conn:
|
with patch('builtins.open', new_open) as conn:
|
||||||
yield conn
|
yield conn
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def ConfigTomlEmpty():
|
def ConfigTomlEmpty():
|
||||||
return {
|
return {
|
||||||
@@ -79,6 +79,7 @@ def ConfigTomlEmpty():
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_no_config(patch_open, ConfigTomlEmpty):
|
def test_no_config(patch_open, ConfigTomlEmpty):
|
||||||
_ = patch_open
|
_ = patch_open
|
||||||
test_buffer.wr = ""
|
test_buffer.wr = ""
|
||||||
@@ -87,6 +88,7 @@ def test_no_config(patch_open, ConfigTomlEmpty):
|
|||||||
cnf = tomllib.loads(test_buffer.wr)
|
cnf = tomllib.loads(test_buffer.wr)
|
||||||
assert cnf == ConfigTomlEmpty
|
assert cnf == ConfigTomlEmpty
|
||||||
|
|
||||||
|
|
||||||
def test_empty_config(patch_open, ConfigTomlEmpty):
|
def test_empty_config(patch_open, ConfigTomlEmpty):
|
||||||
_ = patch_open
|
_ = patch_open
|
||||||
test_buffer.wr = ""
|
test_buffer.wr = ""
|
||||||
@@ -95,6 +97,7 @@ def test_empty_config(patch_open, ConfigTomlEmpty):
|
|||||||
cnf = tomllib.loads(test_buffer.wr)
|
cnf = tomllib.loads(test_buffer.wr)
|
||||||
assert cnf == ConfigTomlEmpty
|
assert cnf == ConfigTomlEmpty
|
||||||
|
|
||||||
|
|
||||||
def test_full_config(patch_open, ConfigComplete):
|
def test_full_config(patch_open, ConfigComplete):
|
||||||
_ = patch_open
|
_ = patch_open
|
||||||
test_buffer.wr = ""
|
test_buffer.wr = ""
|
||||||
@@ -154,6 +157,7 @@ def test_full_config(patch_open, ConfigComplete):
|
|||||||
validated = Config.conf_schema.validate(cnf)
|
validated = Config.conf_schema.validate(cnf)
|
||||||
assert validated == ConfigComplete
|
assert validated == ConfigComplete
|
||||||
|
|
||||||
|
|
||||||
def test_minimum_config(patch_open, ConfigMinimum):
|
def test_minimum_config(patch_open, ConfigMinimum):
|
||||||
_ = patch_open
|
_ = patch_open
|
||||||
test_buffer.wr = ""
|
test_buffer.wr = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user