Fix Pokemon tests and remove unused test files
parent
f6e9b46341
commit
ea57b80d50
12149
test/pokedex.html
12149
test/pokedex.html
File diff suppressed because one or more lines are too long
|
@ -1,44 +1,27 @@
|
|||
import pokemon
|
||||
import os
|
||||
import filecmp
|
||||
|
||||
|
||||
def test_download_national_index_html(tmp_path):
|
||||
pokemon_html = tmp_path / "pokedex.html"
|
||||
pokemon.download_national_index_html(pokemon_html)
|
||||
assert os.path.getsize(pokemon_html) > 500000
|
||||
def test_extract_pokemon_from_pokdex(tmp_path):
|
||||
pokemon_list = pokemon.extract_pokemon_from_pokedex(tmp_path)
|
||||
assert len(pokemon_list) == 1008
|
||||
|
||||
|
||||
def test_get_pokemon_table_row_soups():
|
||||
national_index = "test/test_pokedex.html"
|
||||
row_soups = pokemon.get_pokemon_table_row_soups(national_index)
|
||||
assert len(row_soups) == 994
|
||||
|
||||
|
||||
def test_extract_pokemon_from_table_row(tmp_path):
|
||||
national_index = "test/test_pokedex.html"
|
||||
pokemon.POKEMON_CACHE_DIRECTORY = tmp_path
|
||||
row_soups = pokemon.get_pokemon_table_row_soups(national_index)
|
||||
p = pokemon.extract_pokemon_from_table_row(row_soups[42])
|
||||
def test_get_pokemon_from_table_row(tmp_path):
|
||||
pokemon_list = pokemon.extract_pokemon_from_pokedex(tmp_path)
|
||||
p = pokemon_list[36]
|
||||
assert p.name == "Vulpix"
|
||||
assert p.link_id == "vulpix"
|
||||
assert p.index == "#037"
|
||||
assert p.html_url == "https://bulbapedia.bulbagarden.net/wiki/Vulpix_(Pok%C3%A9mon)"
|
||||
assert (
|
||||
p.img_url
|
||||
== "//archives.bulbagarden.net/media/upload/thumb/3/35/037Vulpix-Alola.png/70px-037Vulpix-Alola.png"
|
||||
)
|
||||
assert p.img_filename.endswith("vulpix.png")
|
||||
assert p.json_filename.endswith("vulpix.json")
|
||||
assert str(p.html_filename).endswith("vulpix.html")
|
||||
assert str(p.img_filename).endswith("vulpix.png")
|
||||
assert p.description == ""
|
||||
assert p.appears_in_book == False
|
||||
|
||||
|
||||
def test_extend_pokemon(tmp_path):
|
||||
national_index = "test/test_pokedex.html"
|
||||
row_soups = pokemon.get_pokemon_table_row_soups(national_index)
|
||||
p = pokemon.extract_pokemon_from_table_row(row_soups[42])
|
||||
pokemon_list = pokemon.extract_pokemon_from_pokedex(tmp_path)
|
||||
p = pokemon_list[36]
|
||||
p.img_filename = tmp_path / "vulpix.png"
|
||||
pokemon.extend_pokemon(p)
|
||||
assert filecmp.cmp(p.img_filename, "test/test_vulpix.png")
|
||||
assert p.img_filename.is_file()
|
||||
assert p.description.startswith("Vulpix (Japanese: \u30ed\u30b3\u30f3 Rokon)")
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB |
Loading…
Reference in New Issue