Skip to content

Commit

Permalink
fix ruff errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolivierarsenault committed Apr 20, 2024
1 parent c9c0a23 commit d08fcb6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
8 changes: 4 additions & 4 deletions tests/test_binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def bypass_connect_client_fixture():


async def test_runout_filament_sensor_missing(hass, get_data, get_printer_objects_list):
"""test."""
"""Test."""
get_data["status"].pop("filament_switch_sensor filament_sensor_1", None)
get_data["status"].pop("filament_switch_sensor filament_sensor_2", None)
get_printer_objects_list["objects"].remove(
Expand All @@ -41,7 +41,7 @@ async def test_runout_filament_sensor_missing(hass, get_data, get_printer_object


async def test_runout_filament_sensor(hass):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand All @@ -52,7 +52,7 @@ async def test_runout_filament_sensor(hass):


async def test_multiple_runout_filament_sensor(hass):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand All @@ -66,7 +66,7 @@ async def test_multiple_runout_filament_sensor(hass):


async def test_runout_filament_sensor_off(hass, get_data):
"""test."""
"""Test."""
get_data["status"]["filament_switch_sensor filament_sensor_1"][
"filament_detected"
] = False
Expand Down
6 changes: 3 additions & 3 deletions tests/test_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def bypass_connect_client_fixture():
],
)
async def test_buttons(hass, button, method):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand All @@ -56,7 +56,7 @@ async def test_buttons(hass, button, method):


async def test_gcode_macro(hass):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand All @@ -79,7 +79,7 @@ async def test_gcode_macro(hass):


async def test_disabled_buttons(hass):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def bypass_connect_client_fixture():
[("mainsail_output_pin_pwm"), ("mainsail_output_pin_CAPITALIZED")],
)
async def test_number_set_value(hass, number, get_default_api_response):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand Down
36 changes: 18 additions & 18 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def test_sensors(
sensor,
value,
):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand Down Expand Up @@ -192,7 +192,7 @@ async def test_sensors_not_printing(
value,
get_data,
):
"""test."""
"""Test."""
get_data["status"]["print_stats"]["state"] = PRINTSTATES.STANDBY.value
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
Expand All @@ -203,7 +203,7 @@ async def test_sensors_not_printing(


async def test_opt_sensor_missing(hass, get_data, get_printer_objects_list):
"""test."""
"""Test."""
get_data["status"].pop("temperature_sensor mcu_temp", None)
get_printer_objects_list["objects"].remove("temperature_sensor mcu_temp")

Expand All @@ -217,7 +217,7 @@ async def test_opt_sensor_missing(hass, get_data, get_printer_objects_list):


async def test_missing_heater_bed(hass, get_data):
"""test."""
"""Test."""
get_data["status"]["heater_bed"]["target"] = None

config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
Expand All @@ -229,7 +229,7 @@ async def test_missing_heater_bed(hass, get_data):


async def test_eta(hass):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand All @@ -246,7 +246,7 @@ async def test_eta(hass):


async def test_slicer_time_left(hass, get_data):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand All @@ -265,7 +265,7 @@ async def test_slicer_time_left(hass, get_data):


async def test_eta_no_current_data(hass, get_data):
"""test."""
"""Test."""
get_data["status"]["print_stats"]["print_duration"] = 0

config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
Expand All @@ -279,18 +279,18 @@ async def test_eta_no_current_data(hass, get_data):


async def test_calculate_pct_job(data_for_calculate_pct):
"""test."""
"""Test."""
assert calculate_pct_job(data_for_calculate_pct) == 0.55


async def test_calculate_pct_job_no_time(data_for_calculate_pct):
"""test."""
"""Test."""
data_for_calculate_pct["estimated_time"] = 0
assert calculate_pct_job(data_for_calculate_pct) == 0.5


async def test_calculate_pct_job_no_filament(data_for_calculate_pct):
"""test."""
"""Test."""
data_for_calculate_pct["filament_total"] = 0
assert calculate_pct_job(data_for_calculate_pct) == 0.6

Expand Down Expand Up @@ -336,7 +336,7 @@ async def test_no_history_data(


async def test_double_sensor_data(hass, get_data, get_printer_objects_list):
"""test."""
"""Test."""
get_printer_objects_list["objects"].append("heater_fan controller_fan")
get_data["status"]["heater_fan controller_fan"] = {"speed": 0.1234}

Expand All @@ -361,7 +361,7 @@ async def test_double_sensor_data(hass, get_data, get_printer_objects_list):


async def test_no_fan_sensor(hass, get_data, get_printer_objects_list):
"""test."""
"""Test."""
get_data["status"].pop("fan")
get_printer_objects_list["objects"].remove("fan")

Expand All @@ -375,7 +375,7 @@ async def test_no_fan_sensor(hass, get_data, get_printer_objects_list):


async def test_rounding_fan(hass, get_data):
"""test."""
"""Test."""
get_data["status"]["fan"]["speed"] = 0.33333333333

config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
Expand All @@ -388,7 +388,7 @@ async def test_rounding_fan(hass, get_data):


async def test_current_layer_in_info():
"""test."""
"""Test."""
data = {
"status": {
"print_stats": {
Expand All @@ -402,7 +402,7 @@ async def test_current_layer_in_info():


async def test_current_layer_calculated():
"""test."""
"""Test."""
data = {
"status": {
"print_stats": {
Expand All @@ -418,7 +418,7 @@ async def test_current_layer_calculated():


async def test_current_layer_calculated_layer_height_0():
"""test."""
"""Test."""
data = {
"status": {
"print_stats": {
Expand All @@ -434,7 +434,7 @@ async def test_current_layer_calculated_layer_height_0():


async def test_current_layer_calculate_missing_layer_height():
"""test."""
"""Test."""
data = {
"status": {
"print_stats": {
Expand All @@ -449,7 +449,7 @@ async def test_current_layer_calculate_missing_layer_height():


async def test_current_layer_calculated_partial_info():
"""test."""
"""Test."""
data = {
"status": {
"print_stats": {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def bypass_connect_client_fixture():
],
)
async def test_switch_turn_on(hass, switch, switch_type, get_default_api_response):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand Down Expand Up @@ -72,7 +72,7 @@ async def test_switch_turn_on(hass, switch, switch_type, get_default_api_respons
],
)
async def test_switch_turn_off(hass, switch, switch_type, get_default_api_response):
"""test."""
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
assert await async_setup_entry(hass, config_entry)
Expand Down

0 comments on commit d08fcb6

Please sign in to comment.