예제 #1
0
def print_data(className, searchTerm, res):
    try:
        res = get_data(className, searchTerm, res)
        if not res:
            print('No results found')
        else:
            for p in res:
                print(p)
    except Exception as e:
        print(e)
예제 #2
0
def test_main():
    json_to_database()
    output = get_data(1, '_id', 71)
    assert output is not None
예제 #3
0
def test_end():
    clear_database()
    output = get_data(1, '_id', 71)
    assert output == []
예제 #4
0
def test_different_value_formats():
    assert get_data(1, '_id', 71)
    assert get_data(1, '_id', '71')
예제 #5
0
def test_invalid_value():
    with pytest.raises(Exception):
        assert get_data(1, '_id', 9999999)
    assert get_data(1, '_id', 9999999) == []
예제 #6
0
def test_invalid_term():
    with pytest.raises(Exception):
        assert get_data(1, 'INVALID_NAME', 71)
예제 #7
0
def test_invalid_class_name():
    with pytest.raises(Exception):
        assert get_data(5, '_id', 71)