Beispiel #1
0
def test__when_a_test_fails__raises_an_error():
    reset()

    @it
    def failing_test(self):
        expect(1).to_be(2)

    expect(lambda: run_tests(test_collection.current_describe, ExceptionReporter())) \
        .to_raise_error_with_message(anything())
Beispiel #2
0
def test__was_called_with_matcher__supports_matchers_for_positional_arguments(
):
    some_instance = SomeClass()

    spy_on(some_instance.some_method)

    some_instance.some_method("some-positional-argument",
                              ["some-array-content"])
    expect(some_instance.some_method).to_be(
        was_called_with(anything(), ["some-array-content"]))
Beispiel #3
0
def test__anything__satisfies_to_be():
    expect(anything()).to_be(1234)
    expect(1234).to_be(anything())
Beispiel #4
0
def test__to_raise_error_with_message__can_pass_with_matcher():
    def error_method():
        raise Exception("some message")

    expect(error_method).to_raise_error_with_message(anything())
Beispiel #5
0
def test__to_be__with_a_matcher_can_pass():
    expect(anything()).to_be(1234)
    expect(1234).to_be(anything())