Beispiel #1
0
def test_task_properties_exceptions():
    t = Task("Foobar")

    # Since we cannot set completed > 1 we can use pytest
    #   to check for python errors using the following syntax.
    with pytest.raises(ValueError):
        t.completed = 2
    
    # Cannot set completed < 0
    with pytest.raises(ValueError):
        t.completed = -1

    # Cannot use set property on creation_datetime
    with pytest.raises(AttributeError):
        t.creation_datetime = datetime.now()