From 81cccbd2289e9a27ca7a2bf3e87930bdb60a8395 Mon Sep 17 00:00:00 2001 From: Hans Erik van Elburg Date: Thu, 24 Dec 2020 01:52:17 +0100 Subject: [PATCH] fix tox tests --- dsmr_parser/obis_references.py | 2 +- dsmr_parser/parsers.py | 6 ++---- test/example_telegrams.py | 2 +- test/test_parse_v5.py | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dsmr_parser/obis_references.py b/dsmr_parser/obis_references.py index ffc215e..fe8952e 100644 --- a/dsmr_parser/obis_references.py +++ b/dsmr_parser/obis_references.py @@ -63,6 +63,6 @@ ELECTRICITY_DELIVERED_TARIFF_ALL = ( # Alternate codes for foreign countries. BELGIUM_HOURLY_GAS_METER_READING = r'\d-\d:24\.2\.3.+?\r\n' # Different code, same format. -LUXEMBOURG_EQUIPMENT_IDENTIFIER = r'\d-\d:42\.0\.0.+?\r\n' # Logical device name +LUXEMBOURG_EQUIPMENT_IDENTIFIER = r'\d-\d:42\.0\.0.+?\r\n' # Logical device name LUXEMBOURG_ELECTRICITY_USED_TARIFF_GLOBAL = r'\d-\d:1\.8\.0.+?\r\n' # Total imported energy register (P+) LUXEMBOURG_ELECTRICITY_DELIVERED_TARIFF_GLOBAL = r'\d-\d:2\.8\.0.+?\r\n' # Total exported energy register (P-) diff --git a/dsmr_parser/parsers.py b/dsmr_parser/parsers.py index 272b59b..5c44f8b 100644 --- a/dsmr_parser/parsers.py +++ b/dsmr_parser/parsers.py @@ -225,8 +225,6 @@ class ProfileGenericParser(DSMRObjectParser): self.parsers_for_unidentified = parsers_for_unidentified def _is_line_wellformed(self, line, values): - - if values and (len(values) == 1) and (values[0] == ''): # special case: single empty parentheses (indicated by empty string) return True @@ -238,9 +236,9 @@ class ProfileGenericParser(DSMRObjectParser): return False def _parse_values(self, values): - if values and (len(values) == 1) and (values[0] == None): + if values and (len(values) == 1) and (values[0] is None): # special case: single empty parentheses; make sure empty ProfileGenericObject is created - values = [0, None] # buffer_length=0, buffer_value_obis_ID=None + values = [0, None] # buffer_length=0, buffer_value_obis_ID=None buffer_length = int(values[0]) buffer_value_obis_ID = values[1] if (buffer_length > 0): diff --git a/test/example_telegrams.py b/test/example_telegrams.py index 143b2a4..f74ed16 100644 --- a/test/example_telegrams.py +++ b/test/example_telegrams.py @@ -127,4 +127,4 @@ TELEGRAM_V5 = ( '0-2:24.1.0(003)\r\n' '0-2:96.1.0()\r\n' '!6EEE\r\n' -) \ No newline at end of file +) diff --git a/test/test_parse_v5.py b/test/test_parse_v5.py index 67d7cd8..fe3ed84 100644 --- a/test/test_parse_v5.py +++ b/test/test_parse_v5.py @@ -241,7 +241,6 @@ class TelegramParserV5Test(unittest.TestCase): def test_checksum_missing(self): # Remove the checksum value causing a ParseError. - corrupted_telegram = TELEGRAM_V5.replace('!87B3\r\n', '') - + corrupted_telegram = TELEGRAM_V5.replace('!6EEE\r\n', '') with self.assertRaises(ParseError): TelegramParser.validate_checksum(corrupted_telegram)