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

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