Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use snake case in tests #24

Merged
merged 1 commit into from
Feb 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions nessclient_tests/test_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def fixture_path(fixture_name: str):


class PacketTestCase(unittest.TestCase):
def testDecodeEncodeIdentity(self):
def test_decode_encode_identity(self):
cases = [
# '8700036100070018092118370677',
'8300c6012345678912EE7'
Expand All @@ -23,14 +23,14 @@ def testDecodeEncodeIdentity(self):
pkt = Packet.decode(case)
self.assertEqual(case, pkt.encode())

def testDecode(self):
def test_decode(self):
with open(fixture_path('sample_output.txt')) as f:
for line in f.readlines():
line = line.strip()
pkt = Packet.decode(line)
_LOGGER.info("Decoded '%s' into %s", line, pkt)

def testUserInterfacePacketDecode(self):
def test_user_interface_packet_decode(self):
pkt = Packet.decode('8300c6012345678912EE7')
self.assertEqual(pkt.start, 0x83)
self.assertEqual(pkt.address, 0x00)
Expand All @@ -41,7 +41,7 @@ def testUserInterfacePacketDecode(self):
self.assertIsNone(pkt.timestamp)
self.assertEqual(pkt.checksum, 0xe7)

def testSystemStatusPacketDecode(self):
def test_system_status_packet_decode(self):
pkt = Packet.decode('8700036100070018092118370974')
self.assertEqual(pkt.start, 0x87)
self.assertEqual(pkt.address, 0x00)
Expand All @@ -53,7 +53,7 @@ def testSystemStatusPacketDecode(self):
year=2018, month=9, day=21, hour=18, minute=37, second=9))
# self.assertEqual(pkt.checksum, 0x74)

def testDecodeWithAddressAndTime(self):
def test_decode_with_address_and_time(self):
pkt = Packet.decode('8709036101050018122709413536')
self.assertEqual(pkt.address, 0x09)
self.assertEqual(pkt.length, 3)
Expand All @@ -64,7 +64,7 @@ def testDecodeWithAddressAndTime(self):
year=2018, month=12, day=27, hour=9, minute=41, second=35))
self.assertFalse(pkt.is_user_interface_resp)

def testDecodeWithoutAddress(self):
def test_decode_without_address(self):
pkt = Packet.decode('820361230001f6')
self.assertIsNone(pkt.address)
self.assertEqual(pkt.length, 3)
Expand All @@ -74,7 +74,7 @@ def testDecodeWithoutAddress(self):
self.assertIsNone(pkt.timestamp)
self.assertFalse(pkt.is_user_interface_resp)

def testDecodeWithAddress(self):
def test_decode_with_address(self):
pkt = Packet.decode('820003600000001b')
self.assertEqual(pkt.address, 0x00)
self.assertEqual(pkt.length, 3)
Expand All @@ -84,7 +84,7 @@ def testDecodeWithAddress(self):
self.assertIsNone(pkt.timestamp)
self.assertTrue(pkt.is_user_interface_resp)

def testEncodeDecode1(self):
def test_encode_decode1(self):
pkt = Packet(
address=0x00,
seq=0x00,
Expand All @@ -95,7 +95,7 @@ def testEncodeDecode1(self):
self.assertEqual(pkt.length, 6)
self.assertEqual(pkt.encode(), '8300660A1234E49')

def testEncodeDecode2(self):
def test_encode_cecode2(self):
pkt = Packet(
address=0x00,
seq=0x00,
Expand All @@ -107,7 +107,7 @@ def testEncodeDecode2(self):
self.assertEqual(pkt.length, 3)
self.assertEqual(pkt.encode(), '87000360000100180510153255E3')

def testDecodeStatusUpdateResponse(self):
def test_decode_status_update_response(self):
'''
82 00 03 60 070000 14
'''
Expand Down