cleaned up based on pylama complaints / pinpointed to coverage version 4.5.4 as next version is incompatible
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
from decimal import Decimal
|
||||
import datetime
|
||||
import unittest
|
||||
import pytz
|
||||
from dsmr_parser import obis_references as obis
|
||||
from dsmr_parser import telegram_specifications
|
||||
from dsmr_parser.exceptions import InvalidChecksumError, ParseError
|
||||
from dsmr_parser.objects import CosemObject, MBusObject, Telegram
|
||||
from dsmr_parser.objects import Telegram
|
||||
from dsmr_parser.parsers import TelegramParser
|
||||
from example_telegrams import TELEGRAM_V4_2
|
||||
parser = TelegramParser(telegram_specifications.V4)
|
||||
telegram = Telegram(TELEGRAM_V4_2, parser, telegram_specifications.V4)
|
||||
|
||||
print(telegram)
|
||||
print(telegram)
|
||||
|
||||
@@ -1,30 +1,21 @@
|
||||
from decimal import Decimal
|
||||
|
||||
import datetime
|
||||
import unittest
|
||||
|
||||
import pytz
|
||||
|
||||
from dsmr_parser import obis_references as obis
|
||||
from dsmr_parser import telegram_specifications
|
||||
from dsmr_parser.exceptions import InvalidChecksumError, ParseError
|
||||
from dsmr_parser.objects import CosemObject, MBusObject, Telegram
|
||||
from dsmr_parser.objects import CosemObject
|
||||
from dsmr_parser.objects import Telegram
|
||||
from dsmr_parser.parsers import TelegramParser
|
||||
from test.example_telegrams import TELEGRAM_V4_2
|
||||
|
||||
|
||||
class TelegramTest(unittest.TestCase):
|
||||
""" Test instantiation of Telegram object """
|
||||
|
||||
def test_instantiate(self):
|
||||
parser = TelegramParser(telegram_specifications.V4)
|
||||
#result = parser.parse(TELEGRAM_V4_2)
|
||||
telegram = Telegram(TELEGRAM_V4_2, parser, telegram_specifications.V4)
|
||||
|
||||
|
||||
|
||||
|
||||
# P1_MESSAGE_HEADER (1-3:0.2.8)
|
||||
#assert isinstance(result[obis.P1_MESSAGE_HEADER], CosemObject)
|
||||
#assert result[obis.P1_MESSAGE_HEADER].unit is None
|
||||
#assert isinstance(result[obis.P1_MESSAGE_HEADER].value, str)
|
||||
#assert result[obis.P1_MESSAGE_HEADER].value == '50'
|
||||
testitem = telegram.P1_MESSAGE_HEADER
|
||||
assert isinstance(testitem, CosemObject)
|
||||
assert testitem.unit is None
|
||||
assert testitem.value == '42'
|
||||
|
||||
Reference in New Issue
Block a user