Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ercpe committed Dec 27, 2015
1 parent f63272d commit 1a00569
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ def test_constructor_invalid_values(self):
self.assertRaises(ValueError, RFAddr, bytearray([0x01]))
self.assertRaises(ValueError, RFAddr, 'a')

self.assertRaises(ValueError, RFAddr, (1, 2))

def test_constructor_valid_values(self):
self.assertEqual(RFAddr('122b65')._bytes, bytearray([0x12, 0x2b, 0x65]))
self.assertEqual(RFAddr(bytearray([0x12, 0x2b, 0x65]))._bytes, bytearray([0x12, 0x2b, 0x65]))
self.assertEqual(RFAddr((0x12, 0x2b, 0x65))._bytes, bytearray([0x12, 0x2b, 0x65]))


def test_equals(self):
# string: case insensitive
self.assertEqual(RFAddr('122b65'), '122b65')
Expand Down Expand Up @@ -137,5 +138,10 @@ def test_equals(self):
self.assertEqual(Device(rf_address=RFAddr('122b65')), Device(rf_address='122b65'))
self.assertEqual(Device(rf_address=RFAddr('122b65')), {'rf_address': '122b65'})
self.assertNotEqual(Device(foo='bar'), Device(baz='bat', blah='blubb'))
self.assertNotEqual(Device(foo='bar', baz='bat'), Device(blah='blubb'))
self.assertNotEqual(Device(foo='bar'), {'baz': 'bat', 'blah': 'blubb'})
self.assertNotEqual(Device(foo='bar'), 1)

def test_misc(self):
d = Device(foo='bar')
self.assertEqual(repr(d), str(d))

0 comments on commit 1a00569

Please sign in to comment.