def test_random(self): quotes = Quotes() keys = ['albert_einstein', 'henry_ford'] q = quotes.random(keys=keys) self.assertTrue(q[0] in ['Albert Einstein', 'Henry Ford']) keys = ['emily_carr', 'does not exist'] q = quotes.random(keys=keys) self.assertEqual(q[0], 'Emily Carr') q = quotes.random(keys=[]) self.assertTrue(q is None)
def quotes(): quotes = Quotes() persons = quotes.random() l = str(persons[1]) print(l, "\n") speak(l)
def gonoobs(self): q=Quotes() qt=q.random() speak('a quote by '+qt[0]+' '+qt[1])
from quotes import Quotes q = Quotes() qt = q.random() print('a quote by ' + qt[0] + ' ' + qt[1])
def quotes1(): quotes = Quotes() persons = quotes.random() l = str(persons[1]) k = emojis.encode(":sunny:") return l + k * 2
def test_random(): q = Quotes(':memory:', connection) q.add('a', 'b', 'c') assert q.random('a') is not None
def test_rigorous(self): quotes = Quotes() print(quotes.random()) self.assertTrue(True)
def test_random_pick(self): quotes = Quotes() picked = [('albert_einstein', 0), ('henry_ford', 1)] quote = quotes.random(pick=picked) expected = ['Albert Einstein', 'Henry Ford'] self.assertTrue(quote[0] in expected)
def test_load_custom_sets(self): # setsfile = os.path.join(os.path.dirname(__file__), "assets/sets.csv") setsfile = "/usr/src/app/quotes/assets/index.csv" quotes = Quotes(setsfile) quotes.random() self.assertTrue(True)