예제 #1
0
 def test_illegal_type(self):
     with pytest.raises(TypeError):
         linear_bin('0')
예제 #2
0
 def test_illegal_pos(self):
     with pytest.raises(IndexError):
         linear_bin(2)
예제 #3
0
 def test_positive(self):
     res = linear_bin(1)
     assert res[14] == 1
     assert sum(res[:14]) == 0
예제 #4
0
 def test_negative(self):
     res = linear_bin(-1)
     assert res[0] == 1
     assert sum(res[1:]) == 0
예제 #5
0
 def test_zero(self):
     res = linear_bin(0)
     assert res[7] == 1
     assert sum(res[:7]) == 0
     assert sum(res[8:]) == 0