def test_true_case():
    """Testing that actual powers of 2 give True"""
    assert check_power_of_2(65536)
def test_false_case():
    """Testing that non-powers of 2 give False"""
    assert not check_power_of_2(12)
def test_negative_number_case():
    """Testing that negative numbers give False"""
    assert not check_power_of_2(-5)
def test_one_number_case():
    """Testing that 1-power of 2 gives True"""
    assert check_power_of_2(1)
def test_zero_number_case():
    """Testing that 0 number gives False"""
    assert not check_power_of_2(0)
Example #6
0
def test_is_bool():
    """Testing that function return boolean value"""
    assert isinstance(check_power_of_2(2), bool)
Example #7
0
def test_power_of_2(value: int, expected_result: bool):
    actual_result = check_power_of_2(value)

    assert actual_result == expected_result
def test_negative_number_case():
    """Testing that a negative number is always not a power of 2"""
    assert not check_power_of_2(-1)
def test_zero_case():
    """Testing that zero is not a power of 2"""
    assert not check_power_of_2(0)