예제 #1
0
    def test_properties(self):
        o = Bits(3)

        with self.assertRaises(TypeError):
            o.strbase = 'abc'

        with self.assertRaises(TypeError):
            o.byteorder = 4

        o.byteorder = 'little'
        self.assertEqual(o.byteorder, 'little')

        o.strbase = 16
        self.assertEqual(o.strbase, 16)
예제 #2
0
    def test_repr(self):
        o = Bits(3)
        r = 'Bits(3, byteorder=\'little\', strbase=10)'
        self.assertEqual(r, repr(o))

        o.byteorder = 'big'
        r = 'Bits(3, byteorder=\'big\', strbase=10)'
        self.assertEqual(r, repr(o))

        o.strbase = 2
        r = 'Bits(3, byteorder=\'big\', strbase=2)'
        self.assertEqual(r, repr(o))