Пример #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")