mirror of
https://github.com/rspeer/wordfreq.git
synced 2024-12-23 09:21:37 +00:00
specifically test that the long sequence underflows to 0
This commit is contained in:
parent
75a56b68fb
commit
ed23bf3ebe
@ -1,4 +1,4 @@
|
||||
from wordfreq import tokenize, word_frequency
|
||||
from wordfreq import tokenize, word_frequency, zipf_frequency
|
||||
import pytest
|
||||
|
||||
|
||||
@ -80,8 +80,10 @@ def test_alternate_codes():
|
||||
|
||||
|
||||
def test_unreasonably_long():
|
||||
# This crashed earlier versions of wordfreq
|
||||
# This crashed earlier versions of wordfreq due to an overflow in
|
||||
# exponentiation. We've now changed the sequence of operations so it
|
||||
# will underflow instead.
|
||||
lots_of_ls = 'l' * 800
|
||||
assert word_frequency(lots_of_ls, 'zh') < 1e-300
|
||||
assert word_frequency(lots_of_ls, 'zh') == 0.
|
||||
assert zipf_frequency(lots_of_ls, 'zh') == 0.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user