tests: books.Loader tests do more bounds checking.
This commit is contained in:
parent
38cea37715
commit
5601ece2ac
1 changed files with 9 additions and 3 deletions
|
@ -67,7 +67,9 @@ def txn_years(entries):
|
||||||
def test_load_fy_range(conservancy_loader, from_fy, to_fy, expect_years):
|
def test_load_fy_range(conservancy_loader, from_fy, to_fy, expect_years):
|
||||||
entries, errors, options_map = conservancy_loader.load_fy_range(from_fy, to_fy)
|
entries, errors, options_map = conservancy_loader.load_fy_range(from_fy, to_fy)
|
||||||
assert not errors
|
assert not errors
|
||||||
assert txn_years(entries).issuperset(expect_years)
|
actual_years = txn_years(entries)
|
||||||
|
assert actual_years.issuperset(expect_years)
|
||||||
|
assert min(actual_years) == expect_years.start
|
||||||
|
|
||||||
def test_load_fy_range_does_not_duplicate_openings(conservancy_loader):
|
def test_load_fy_range_does_not_duplicate_openings(conservancy_loader):
|
||||||
entries, errors, options_map = conservancy_loader.load_fy_range(2010, 2030)
|
entries, errors, options_map = conservancy_loader.load_fy_range(2010, 2030)
|
||||||
|
@ -85,7 +87,9 @@ def test_load_all(conservancy_loader, from_year):
|
||||||
from_year = from_year or 2018
|
from_year = from_year or 2018
|
||||||
assert not errors
|
assert not errors
|
||||||
check_openings(entries)
|
check_openings(entries)
|
||||||
assert txn_years(entries).issuperset(range(from_year or 2018, 2021))
|
actual_years = txn_years(entries)
|
||||||
|
assert actual_years.issuperset(range(from_year, 2021))
|
||||||
|
assert min(actual_years) == from_year
|
||||||
|
|
||||||
@pytest.mark.parametrize('from_date', [
|
@pytest.mark.parametrize('from_date', [
|
||||||
date(2019, 2, 1),
|
date(2019, 2, 1),
|
||||||
|
@ -100,4 +104,6 @@ def test_load_all_from_date(conservancy_loader, from_date):
|
||||||
entries, errors, options_map = conservancy_loader.load_all(from_date)
|
entries, errors, options_map = conservancy_loader.load_all(from_date)
|
||||||
assert not errors
|
assert not errors
|
||||||
check_openings(entries)
|
check_openings(entries)
|
||||||
assert txn_years(entries).issuperset(range(from_year, 2021))
|
actual_years = txn_years(entries)
|
||||||
|
assert actual_years.issuperset(range(from_year, 2021))
|
||||||
|
assert min(actual_years) == from_year
|
||||||
|
|
Loading…
Reference in a new issue