コード例 #1
0
def matches_when_submatchers_all_match():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )
    
    assert_equal(matched(), matcher.match(User("bob", "*****@*****.**")))
コード例 #2
0
def description_contains_descriptions_of_submatchers():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )

    assert_equal(
        "any of:\n  * object with attribute username: '******'\n  * object with attribute email_address: '*****@*****.**'",
        matcher.describe())
コード例 #3
0
def description_contains_descriptions_of_submatchers():
    matcher = any_of(
        has_attr("username", equal_to("bob")),
        has_attr("email_address", equal_to("*****@*****.**")),
    )
    
    assert_equal(
        "any of:\n * object with attribute username: '******'\n * object with attribute email_address: '*****@*****.**'",
        matcher.describe()
    )
コード例 #4
0
def description_contains_description_of_property():
    assert_equal(
        "object with attribute username: '******'",
        has_attr("username", equal_to("bob")).describe()
    )
コード例 #5
0
def submatcher_is_coerced_to_matcher():
    assert_equal(
        unmatched("attribute username was 'bobbity'"),
        has_attr("username", "bob").match(User("bobbity"))
    )
コード例 #6
0
def explanation_of_mismatch_contains_mismatch_of_property():
    assert_equal(
        unmatched("attribute username was 'bobbity'"),
        has_attr("username", equal_to("bob")).match(User("bobbity"))
    )
コード例 #7
0
def mismatches_when_property_is_missing():
    assert_equal(
        unmatched("was missing attribute username"),
        has_attr("username", equal_to("bob")).match("bobbity")
    )
コード例 #8
0
def matches_when_property_has_correct_value():
    assert_equal(matched(), has_attr("username", equal_to("bob")).match(User("bob")))
コード例 #9
0
def description_contains_description_of_property():
    assert_equal("object with attribute username: '******'",
                 has_attr("username", equal_to("bob")).describe())
コード例 #10
0
def submatcher_is_coerced_to_matcher():
    assert_equal(unmatched("attribute username was 'bobbity'"),
                 has_attr("username", "bob").match(User("bobbity")))
コード例 #11
0
def explanation_of_mismatch_contains_mismatch_of_property():
    assert_equal(unmatched("attribute username was 'bobbity'"),
                 has_attr("username", equal_to("bob")).match(User("bobbity")))
コード例 #12
0
def mismatches_when_property_is_missing():
    assert_equal(unmatched("was missing attribute username"),
                 has_attr("username", equal_to("bob")).match("bobbity"))
コード例 #13
0
def matches_when_property_has_correct_value():
    assert_equal(matched(),
                 has_attr("username", equal_to("bob")).match(User("bob")))
コード例 #14
0
def test_client_can_be_created():
    client = SpellClient(spell_conn_id="testing-spell-client")
    assert_that(client, has_attr("spell_conn_id", "testing-spell-client"))