示例#1
0
def test_id_matches_exact():
    data = {'$id': '2'}
    assert id_matches(data, data['$id'])
示例#2
0
def test_id_matches_no_id():
    data = {'blarg': '2'}
    assert not id_matches(data, data['blarg'])
示例#3
0
def test_list_is_not_match_and_does_not_error():
    data = [{'$id': '2'}, {'$id': '3'}]
    assert not id_matches(data, '2')
示例#4
0
def test_non_iterable_data_type_is_not_match_and_does_not_error():
    assert not id_matches(2.14376, '2')
示例#5
0
def test_empty_is_not_match_and_does_not_error():
    assert not id_matches({}, '2')
示例#6
0
def test_none_is_not_match_and_does_not_error():
    assert not id_matches(None, '2')
示例#7
0
def test_id_does_not_match():
    data = {'$id': '2'}
    ref = str(int(data['$id']) + 1)
    assert not id_matches(data, ref)