Exemplo n.º 1
0
def test_not_called_fail(desc):
    matcher = not_called()
    expected = "was called 1 times with ('foo', )"

    mock = Mock()
    mock('foo')

    ok = matcher.matches(mock, desc)

    assert_that(ok, equal_to(False))
    assert_that(str(desc), equal_to(expected))
Exemplo n.º 2
0
def test_not_called_fail(desc):
    matcher = not_called()
    expected = "was called 1 times with ('foo', )"

    mock = Mock()
    mock('foo')

    ok = matcher.matches(mock, desc)

    assert_that(ok, equal_to(False))
    assert_that(str(desc), equal_to(expected))
Exemplo n.º 3
0
def test_not_called_fail():
    expected = '''
Expected: Mock called with ANYTHING 0 times
     but: was called 1 times
'''

    mock = Mock()
    mock('foo')

    with assert_raises(AssertionError) as e:
        assert_that(mock, not_called())

    assert_that(str(e.exception), equal_to(expected))
Exemplo n.º 4
0
def test_not_called_ok():
    mock = Mock()

    assert_that(mock, not_called())
Exemplo n.º 5
0
def test_not_called_description(desc):
    matcher = not_called()
    expected = 'Mock called <0> times with ANYTHING'
    matcher.describe_to(desc)
    assert_that(str(desc), equal_to(expected))
Exemplo n.º 6
0
def test_not_called_ok():
    matcher = not_called()
    mock = Mock()

    ok = matcher.matches(mock)
    assert_that(ok, equal_to(True))
Exemplo n.º 7
0
def test_not_called_description(desc):
    matcher = not_called()
    expected = 'Mock called <0> times with ANYTHING'
    matcher.describe_to(desc)
    assert_that(str(desc), equal_to(expected))
Exemplo n.º 8
0
def test_not_called_ok():
    matcher = not_called()
    mock = Mock()

    ok = matcher.matches(mock)
    assert_that(ok, equal_to(True))