コード例 #1
0
def test_assert_dicts_passed_all_required():
    test_dict = {"foo": "bar"}

    passed, description = runner.assert_dicts(expected=test_dict,
                                              actual=test_dict,
                                              all_required=True)

    assert passed
    assert description == "passed"
コード例 #2
0
def test_assert_dicts_failed_subset():
    expected_dict = {"foo": "bar"}

    actual_dict = {"fizz": "buzz"}

    passed, description = runner.assert_dicts(expected=expected_dict,
                                              actual=actual_dict,
                                              all_required=False)

    assert not passed
    assert description == "Expected {'foo': 'bar'} to be in {'fizz': 'buzz'}"
コード例 #3
0
def test_assert_dicts_passed_subset():
    expected_dict = {"foo": "bar"}

    actual_dict = {"foo": "bar", "fizz": "buzz"}

    passed, description = runner.assert_dicts(expected=expected_dict,
                                              actual=actual_dict,
                                              all_required=False)

    assert passed
    assert description == "passed"
コード例 #4
0
def test_assert_dicts_failed_all_required():
    expected_dict = {"foo": "bar"}

    actual_dict = {"foo": "bar", "fizz": "buzz"}

    passed, description = runner.assert_dicts(expected=expected_dict,
                                              actual=actual_dict,
                                              all_required=True)

    assert not passed
    assert description == "Expected {'foo': 'bar'}, got {'foo': 'bar', 'fizz': 'buzz'}"
コード例 #5
0
def test_assert_dicts_failed_subset():
    expected_dict = {"foo": "bar"}

    actual_dict = {"fizz": "buzz"}

    passed, description = runner.assert_dicts(expected=expected_dict,
                                              actual=actual_dict,
                                              all_required=False)

    assert not passed
    assert description == "The following items were not found: {'foo': \"foo not in {'fizz': 'buzz'}\"}"