Skip to content

Commit

Permalink
fix test issue that count variable unexpectedly overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaehashi committed Sep 24, 2022
1 parent 6d3ca80 commit 43db3c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions atwiki/test/test_core.py
Original file line number Diff line number Diff line change
@@ -78,9 +78,9 @@ def test_get_list(self):
text = soup.find('div', class_='pagelist').text
m = re.search(r'計 (\d+) ページ / 1 から 100 を表示', text)
assert m is not None
count = int(m.group(1))
assert 45000 < count < 90000
last_index = math.ceil(count / 100)
total_count = int(m.group(1)) # Total number of pages
assert 45000 < total_count < 90000
last_index = math.ceil(total_count / 100)

# Ensure listing pagerize works. (retrieve 3 listing, 100 pages in each)
count = 0
@@ -94,7 +94,7 @@ def test_get_list(self):
# Get list from the last listing.
# N.B. The page counter is not updated immediately.
pages = list(self._api.get_list(_start=last_index))
expected = (count % 100)
expected = (total_count % 100)
assert max(0, (expected - 50)) < len(pages) < min(100, (expected + 50))

# Get out-of-bounds listing. (expected to wrap around)

0 comments on commit 43db3c9

Please sign in to comment.