Beispiel #1
0
 def testTypeError(self):
     with pytest.raises(TypeError):
         pulsebox.hex_split(0.1)
     with pytest.raises(TypeError):
         pulsebox.hex_split("a")
     with pytest.raises(TypeError):
         pulsebox.hex_split(True)
Beispiel #2
0
 def testValueError(self):
     with pytest.raises(ValueError):
         pulsebox.hex_split(-1)
     with pytest.raises(ValueError):
         pulsebox.hex_split(2 ** 32)
Beispiel #3
0
 def testSmall(self):
     assert pulsebox.hex_split(15) == ("0x0", "0xf")
     assert pulsebox.hex_split(255) == ("0x0", "0xff")
     assert pulsebox.hex_split(4095) == ("0x0", "0xfff")
     assert pulsebox.hex_split(65535) == ("0x0", "0xffff")
Beispiel #4
0
 def testLarge(self):
     assert pulsebox.hex_split(65536) == ("0x1", "0x0")
     assert pulsebox.hex_split(1048575) == ("0xf", "0xffff")
     assert pulsebox.hex_split(16777215) == ("0xff", "0xffff")
     assert pulsebox.hex_split(268435455) == ("0xfff", "0xffff")
     assert pulsebox.hex_split(4294967295) == ("0xffff", "0xffff")
Beispiel #5
0
 def testZero(self):
     assert pulsebox.hex_split(0) == ("0x0", "0x0")