Skip to content

Commit

Permalink
A couple more test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-griffiths committed Nov 29, 2023
1 parent f693888 commit bf0d6e4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_bitstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ class NoFixedLengthPackingBug(unittest.TestCase):
def testPackingBytesWithNoLength(self):
a = bitstring.pack('bytes', b'abcd')
self.assertEqual(a.bytes, b'abcd')
b = bitstring.pack('u12, bytes, bool', 0, b'deadbeef', True)
self.assertEqual(b.unpack('u12, bytes, bool'), [0, b'deadbeef', True])

def testPackingBinWithNoLength(self):
a = bitstring.pack('bin', '0001')
Expand All @@ -197,6 +199,11 @@ def testReadingBytesWithNoLength(self):
a = bitstring.BitStream(b'hello')
b = a.read('bytes')
self.assertEqual(b, b'hello')
c = bitstring.BitStream('0xabc, u13=99')
c += b'123abc'
c += bitstring.Bits('bfloat=4')
c.pos = 0
self.assertEqual(c.readlist('h12, u13, bytes, bfloat'), ['abc', 99, b'123abc', 4.0])

def testReadingBinWithNoLength(self):
a = bitstring.BitStream('0b1101')
Expand Down

0 comments on commit bf0d6e4

Please sign in to comment.