Beispiel #1
0
def test_database_single_arg(arg):
    # Test the database where there is a single command line parameter.
    # The parameter is the name of the method to test.
    arg = arg[1].lower()
    db = Database()
    if arg == "__str__":
        print(db)
    elif arg == "__len__":
        print(len(db))
    elif arg == "get_all":
        print_items(db.get_all())
    elif arg == "get_regions":
        print_items(db.get_regions())
    elif arg == "get_kanto":
        print_items(db.get_kanto())
    elif arg == "get_johto":
        print_items(db.get_johto())
    elif arg == "get_hoenn":
        print_items(db.get_hoenn())
    elif arg == "get_sinnoh":
        print_items(db.get_sinnoh())
    elif arg == "get_unova":
        print_items(db.get_unova())
    elif arg == "get_kalos":
        print_items(db.get_kalos())
    elif arg == "get_extra":
        print_items(db.get_extra())
    elif arg == "get_random":
        print(db.get_random())
    else:
        print("No such public method '" + arg +
              "' with zero parameters exists in the Database class.")
Beispiel #2
0
def test_get_extras():
    db = Database()
    assert db.get_extra(), 'db.get_extra() returns no pokemon'
    assert len(db.get_extra()) == sum(make_extra_counts().values())
Beispiel #3
0
def test_len():
    db = Database()
    assert len(db) == MAX_ID + len(db.get_extra())
    assert len(db.get_all()) == MAX_ID + len(db.get_extra())