Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
asmith26 committed Feb 13, 2023
1 parent b4ffcc1 commit 9025ffc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

empty_file_error = "Please provide a file containing a corpus \(not an empty file\)."
binary_file_error = "Please provide a file containing text-based data."
nonnegative_integer_error = "Please enter a non-negative integer for the number of samples desired\: "
negative_integer_error = "Please enter a non-negative integer for the number of samples desired. size="


class TestValidation(unittest.TestCase):
Expand Down Expand Up @@ -49,15 +49,15 @@ def test_negative_integer(self):
words = vose_sampler.get_words(valid_folder + "small.txt")
word_dist = vose_sampler.sample2dist(words)
VA_words = vose_sampler.VoseAlias(word_dist)
self.assertRaisesRegex(ValueError, nonnegative_integer_error + "-1", VA_words.sample_n, -1)
self.assertRaisesRegex(ValueError, negative_integer_error + "-1", VA_words.sample_n, -1)

def test_zero_integer(self):
"""Test vose_sampler.ProbDistribution.alias_generation against a size
defined by zero. """
words = vose_sampler.get_words(valid_folder + "small.txt")
word_dist = vose_sampler.sample2dist(words)
VA_words = vose_sampler.VoseAlias(word_dist)
self.assertRaisesRegex(ValueError, nonnegative_integer_error + "0", VA_words.sample_n, 0)
self.assertEqual([], VA_words.sample_n(size=0))


class TestAccuracy(unittest.TestCase):
Expand Down

0 comments on commit 9025ffc

Please sign in to comment.