used python unittest for the tests

This commit is contained in:
Nigel Dokter 2016-11-26 15:33:58 +01:00
parent 819d0d0696
commit 4df6ba75a2
2 changed files with 164 additions and 161 deletions

View File

@ -1,4 +1,4 @@
"""Test parsing of a DSMR v2.2 telegram.""" import unittest
from dsmr_parser.parsers import TelegramParserV2_2 from dsmr_parser.parsers import TelegramParserV2_2
from dsmr_parser import telegram_specifications from dsmr_parser import telegram_specifications
@ -28,9 +28,10 @@ TELEGRAM_V2_2 = [
] ]
def test_parse(): class TelegramParserV2_2Test(unittest.TestCase):
"""Test if telegram parsing results in correct results.""" """ Test parsing of a DSMR v2.2 telegram. """
def test_parse(self):
parser = TelegramParserV2_2(telegram_specifications.V2_2) parser = TelegramParserV2_2(telegram_specifications.V2_2)
result = parser.parse(TELEGRAM_V2_2) result = parser.parse(TELEGRAM_V2_2)

View File

@ -1,6 +1,6 @@
"""Test parsing of a DSMR v4.2 telegram."""
import datetime
from decimal import Decimal from decimal import Decimal
import datetime
import unittest
import pytz import pytz
@ -47,8 +47,10 @@ TELEGRAM_V4_2 = [
'!5D83', '!5D83',
] ]
class TelegramParserV4_2Test(unittest.TestCase):
""" Test parsing of a DSMR v4.2 telegram. """
def test_parse(): def test_parse(self):
parser = TelegramParser(telegram_specifications.V4) parser = TelegramParser(telegram_specifications.V4)
result = parser.parse(TELEGRAM_V4_2) result = parser.parse(TELEGRAM_V4_2)