示例#1
0
def test_is_in_success():
    assert_match_success(is_in([1, 2, 3]), 1, "1")
示例#2
0
def test_equal_to_success():
    assert_match_success(equal_to(1), 1, "1")
示例#3
0
def test_has_length_success():
    assert_match_success(has_length(3), "foo", "3")
示例#4
0
def test_less_than_success():
    assert_match_success(less_than(1), 0, "0")
示例#5
0
def test_is_between_success():
    assert_match_success(is_between(1, 3), 2, "2")
示例#6
0
def test_is_false_success():
    assert_match_success(is_false(), False, "false")
示例#7
0
def test_greater_than_success():
    assert_match_success(greater_than(1), 2, "2")
示例#8
0
def test_is_integer_with_arg_success():
    assert_match_success(is_integer(1), 1, "1")
示例#9
0
def test_is_bool_success():
    assert_match_success(is_bool(), True, "true")
示例#10
0
def test_is_float_with_arg_success():
    assert_match_success(is_float(1.2), 1.2, "1.2")
示例#11
0
def test_is_integer_success():
    assert_match_success(is_integer(), 1, "1")
示例#12
0
def test_is_float_success():
    assert_match_success(is_float(), 1.2, "1.2")
示例#13
0
def test_is_dict_with_argument_success():
    assert_match_success(is_dict(has_entry("foo")), {"foo": 1}, "1")
示例#14
0
def test_has_item_success():
    result = assert_match_success(has_item(greater_than(2)), [1, 3], "index 1")
    assert result.index == 1
    assert result.item == 3
示例#15
0
def test_is_str_with_arg_success():
    assert_match_success(is_str("foo"), "foo", "foo")
示例#16
0
def test_is_bool_with_arg_success():
    assert_match_success(is_bool(True), True, "true")
示例#17
0
def test_is_true_success():
    assert_match_success(is_true(), True, "true")
示例#18
0
def test_is_list_success():
    assert_match_success(is_list(), [], "[]")
示例#19
0
def test_not_equal_to_success():
    assert_match_success(not_equal_to(1), 2, "2")
示例#20
0
def test_is_list_with_tuple_success():
    assert_match_success(is_list(), (), "[]")
示例#21
0
def test_greater_than_or_equal_to_success():
    assert_match_success(greater_than_or_equal_to(1), 1, "1")
示例#22
0
def test_is_list_with_arg_success():
    assert_match_success(is_list(has_length(2)), [21, 42], "2")
示例#23
0
def test_less_than_or_equal_to_success():
    assert_match_success(less_than_or_equal_to(1), 1, "1")
示例#24
0
def test_is_dict_success():
    assert_match_success(is_dict(), {}, "{}")
示例#25
0
def test_is_none_success():
    assert_match_success(is_none(), None, "null")
示例#26
0
def test_is_str_success():
    assert_match_success(is_str(), "foo", "foo")
示例#27
0
def test_is_not_none_success():
    assert_match_success(is_not_none(), "foo", "foo")
示例#28
0
def test_is_str_with_unicode_success():
    assert_match_success(is_str(), u"ààà", u"ààà")
示例#29
0
def test_has_length_with_matcher_success():
    assert_match_success(has_length(greater_than(2)), "foo", "3")
示例#30
0
def test_has_only_values_success():
    assert_match_success(has_only_values([3, 1, 2]), [1, 2, 3], "got")