Ejemplo n.º 1
0
def test_dictify_returns_dict():

    result = schools.dictify(schools.closest("JAKE"))
    assert isinstance(result, list)

    result = schools.dictify(schools.exact("Shepaug Valley School"))
    assert isinstance(result, list)
Ejemplo n.º 2
0
def test_jsonify_returns_json():

    result = schools.jsonify(schools.closest("JAKE"))
    assert isinstance(json.loads(result), list)

    result = schools.jsonify(schools.exact("Shepaug Valley School"))
    assert isinstance(json.loads(result), list)
Ejemplo n.º 3
0
import ct_schools.schools as schools

print "-" * 20
print "FIND THE CLOSEST MATCH"
print schools.closest("Shepau Vall")

print "-" * 20
print "FIND THE CLOSEST 3 MATCHES"
print schools.closest("Shepaug Valley School",lim=3)

print "-" * 20
print "FIND AN EXACT (CASE-INSENSITIVE) MATCH"
print schools.exact("Shepaug Valley School")

print "-" * 20
print "FIND ALL MATCHES WITH A FUZZ RATIO ABOVE 80"
print schools.fuzzy("Shepaug Valley School", ratio=80)



Ejemplo n.º 4
0
def test_exact_fail_rasies_exception():
    with pytest.raises(Exception):
        schools.exact("FAKE FAKE SCHOOL")
Ejemplo n.º 5
0
def test_exact_success_returns_dataframe():
    assert isinstance(schools.exact("SHEPAUG VALLEY SCHOOL"), pd.DataFrame)