def test_required_fields_present(): llc = LanguageListCreator() word = llc.random_verbs(1)[0] assert "Word" in word assert "First Translation" in word assert "Second Translation" in word assert "First Compound" in word assert "First Compound Translation" in word assert "Second Compound" in word assert "Second Compound Translation" in word
def test_required_fields_present(): llc = LanguageListCreator() word = llc.random_verbs(1)[0] assert "Original Word" in word assert "First Translation" in word assert "Second Translation" in word assert "First Compound" in word assert "First Compound Translation" in word assert "Second Compound" in word assert "Second Compound Translation" in word
def test_same_verb_not_produced_twice(): llc = LanguageListCreator() assert llc.random_verbs(1) is not llc.random_verbs(1)
def test_length_list_correct(): llc = LanguageListCreator() assert len(llc.random_verbs(10)) == 10 assert len(llc.random_verbs(0)) == 0
def test_length_list_correct(): llc = LanguageListCreator() assert len(llc.random_verbs(10)) ==10 assert len(llc.random_verbs(0)) == 0
#!/usr/bin/env python from prettytable import PrettyTable from langtools.LanguageListCreator import LanguageListCreator llc = LanguageListCreator() verbs = llc.random_verbs(5) table = PrettyTable([ "Word", "First Translation", "Second Translation", "First Compound", "First Compound Translation", #"Second Compound", #"First Compound Translation", ]) for translations in verbs: def xstr(s): return "---" if s is None else s table.add_row([ translations["Original Word"], translations["First Translation"], xstr(translations["Second Translation"]), xstr(translations["First Compound"]), xstr(translations["First Compound Translation"]), #xstr(translations["Second Compound"]), #xstr(translations["Second Compound Translation"]), ])