Skip to content

Instantly share code, notes, and snippets.

@robvanderleek
Last active August 10, 2017 15:43
Show Gist options
  • Save robvanderleek/3410c76aae76b87c5c1e4563c12c4284 to your computer and use it in GitHub Desktop.
Save robvanderleek/3410c76aae76b87c5c1e4563c12c4284 to your computer and use it in GitHub Desktop.
Test case for generator.py
import unittest
from buzz import generator
def test_sample_single_word():
l = ('foo', 'bar', 'foobar')
word = generator.sample(l)
assert word in l
def test_sample_multiple_words():
l = ('foo', 'bar', 'foobar')
words = generator.sample(l, 2)
assert len(words) == 2
assert words[0] in l
assert words[1] in l
assert words[0] is not words[1]
def test_generate_buzz_of_at_least_five_words():
phrase = generator.generate_buzz()
assert len(phrase.split()) >= 5
@aalladin
Copy link

ImportError while importing test module /cicd-buzz/tests/test_generator.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test_generator.py:3: in
from buzz import generator
E ImportError: No module named buzz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment