Exemple #1
0
def test_negative_case():
    """Testing that non-powers of 2 give False"""
    assert not check_power_of_2(12)    
Exemple #2
0
def test_power_of_2(value: int, expected_result: bool):
    actual_result = check_power_of_2(value)

    assert actual_result == expected_result
Exemple #3
0
def test_null_case():
    """Testing that 0 give False"""
    assert not check_power_of_2(0)
Exemple #4
0
def test_positive_case():
    """Testing that actual powers of 2 give True"""
    assert check_power_of_2(65536)
def test_wrong_case():
    """Testing that function work with wrong arguments"""
    assert not check_power_of_2("as")
def test_negative_case3():
    """Testing that non-int input() will not crash the program"""
    assert not check_power_of_2("some string")
def test_negative_case2():
    """Testing that zero is not power of 2. give False"""
    assert not check_power_of_2(0)
Exemple #8
0
def test_negative_argument():
    """Testing that negative arguments give False."""
    assert not check_power_of_2(-16)
Exemple #9
0
def test_zero_argument():
    """Test that zero gives False."""
    assert not check_power_of_2(0)