mirror of
https://github.com/LazoCoder/Pokemon-Terminal
synced 2025-02-17 05:18:31 +00:00
- Adds new tests of the new command engine - Regions and pokemon types and names are now case insensitive - Roll back some of the removed tests.
29 lines
960 B
Python
29 lines
960 B
Python
from filters import Filter
|
|
import pytest
|
|
|
|
|
|
def test_basic_loading():
|
|
assert len(Filter.POKEMON_LIST) >= 493
|
|
assert len(Filter.filtered_list) == len(Filter.POKEMON_LIST)
|
|
|
|
|
|
def test_filters_infrastructure():
|
|
inst = Filter(None, None)
|
|
with pytest.raises(NotImplementedError):
|
|
inst.matches(None, None)
|
|
for fltr in Filter.FILTERS:
|
|
fltr = fltr(None, None)
|
|
filtered = [pkmn for pkmn in Filter.POKEMON_LIST
|
|
if fltr.matches(pkmn, fltr.EXAMPLE_VAL)]
|
|
assert len(filtered) < len(Filter.POKEMON_LIST)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# Test runner: Runs all functions whose name begins with `test_`
|
|
# locals() changes when trying to do this without the list comprehension!!!
|
|
name_funcs = [(n, f) for n, f in locals().items() if n.startswith('test_')]
|
|
for name, func in name_funcs:
|
|
if callable(func):
|
|
func()
|
|
else:
|
|
print(name + ' is not callable()!')
|