Esempio 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))
Esempio 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))
Esempio 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))
Esempio n. 4
0
def test_not_called_ok():
    mock = Mock()

    assert_that(mock, not_called())
Esempio 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))
Esempio n. 6
0
def test_not_called_ok():
    matcher = not_called()
    mock = Mock()

    ok = matcher.matches(mock)
    assert_that(ok, equal_to(True))
Esempio 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))
Esempio n. 8
0
def test_not_called_ok():
    matcher = not_called()
    mock = Mock()

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