Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat seed 0 as given #18

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion xeger/tests/test_xeger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import itertools
import re
import unittest
import xeger
Expand Down Expand Up @@ -184,6 +185,9 @@ def test_xeger_random_instance():
assert string1 == string2


def test_xeger():
assert xeger.Xeger(seed=0).xeger('.{1,8}') == xeger.Xeger(seed=0).xeger('.{1,8}')


if __name__ == '__main__':
pytest.main([__file__, '-vv'])

2 changes: 1 addition & 1 deletion xeger/xeger.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, limit=10, seed=None):
self._random = Random()
self.random_choice = self._random.choice
self.random_int = self._random.randint
if seed:
if seed is not None:
self.seed(seed)

self._alphabets = {
Expand Down