Skip to content

Commit

Permalink
Bump minimum python to 3.6 to use f string
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyralex committed Jul 14, 2021
1 parent e620f6b commit 3ad05eb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.5, 3.8, 3.9]
python-version: [3.6, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ run those other applications.
Requirements
------------

- Python 3.5 or newer with asyncio
- Python 3.6 or newer with asyncio
- An Anthem MRX or AVM receiver or processor

Known Issues
Expand Down
6 changes: 3 additions & 3 deletions anthemav/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __init__(self, update_callback=None, loop=None, connection_lost_callback=Non
self.transport = None

for key in LOOKUP:
setattr(self, "_" + key, "")
setattr(self, f"_{key}", "")

self._Z1POW = "0"

Expand Down Expand Up @@ -269,7 +269,7 @@ def _assemble_buffer(self):

for message in self.buffer.split(";"):
if message != "":
self.log.debug("assembled message " + message)
self.log.debug("assembled message %s", message)
self._parse_message(message)

self.buffer = ""
Expand All @@ -285,7 +285,7 @@ def _populate_inputs(self, total):
"""
total = total + 1
for input_number in range(1, total):
self.query("ISN" + str(input_number).zfill(2))
self.query(f"ISN{input_number:02d}")

def _parse_message(self, data):
"""Interpret each message datagram from device and do the needful.
Expand Down
10 changes: 8 additions & 2 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from typing import Protocol
from anthemav.protocol import ALM_NUMBER, LOOKUP
import pytest
from anthemav import AVR
from unittest.mock import patch

Expand Down Expand Up @@ -44,3 +42,11 @@ def test_mute_force_refresh():
with patch.object(avr, "query") as mock:
avr.mute = True
mock.assert_called_once_with("Z1MUT")


def test_populate_input():
avr = AVR()
with patch.object(avr, "query") as mock:
avr._populate_inputs(2)
mock.assert_any_call("ISN01")
mock.assert_called_with("ISN02")

0 comments on commit 3ad05eb

Please sign in to comment.