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