def test_correct_numerals(self): """Roman.is_roman_numeral should return True for correct roman numerals.""" for numeral in correct_numerals: self.assertTrue( roman.Roman.is_roman_numeral(numeral), msg="'{0}' is not an incorrect numeral.".format(numeral)) self.assertEqual(numeral, str(roman.Roman(numeral)))
def __init__(self): self.__intergalactic = {} self.__metal = {} self._symbol = roman.Roman() self._command_types = MappingProxyType({ "ASSIGMENT": "^([A-Za-z]+) is ([A-Z])$", "CREDITS": "^([A-Za-z]+)([A-Za-z\\s]*) is ([0-9]+) (Credits)$", "HOW_MUCH": "^how much is (([A-Za-z\\s])+)\\?$", "HOW_MANY": "^how many Credits is (([A-Za-z\\s])+)\\?$", })
def test_inversion(self): for i in range(1, 4000): self.assertEqual(int(roman.Roman(i)), i)
def test_known_numerals(self): """Roman(numeral) converts to the right integer.""" for numeral, value in known_numerals: self.assertEqual(int(roman.Roman(numeral)), value)
def test_known_numerals(self): """Roman(integer) makes a correct numeral.""" for numeral, value in known_numerals: self.assertEqual(str(roman.Roman(value)), numeral)
def test_two_plus_five(self): self.assertEqual("VII", roman.Roman().add("II", "V"))
def test_one_plus_two(self): self.assertEqual("III", roman.Roman().add("I", "II"))
def test_three_plus_three(self): self.assertEqual("VI", roman.Roman().add("III", "III"))
def __init__(self, fenetre, **kwargs): Tk.__init__(self) self.title("Thot") # changer le titre de la fenêtre self.geometry("1080x900") # changer les dimension de la fenêtre self.minsize(480, 360) # fixer la taille min de la fenêtre self.iconbitmap("thot.ico") # donner l'url du l'icone self.config(background='#000000') # Donner la couleur de fond self.main = Frame(fenetre, padding="4 4 4 4", background='#E2BC74') # On déclare la frame principale self.main.pack(fill=BOTH) fenetre.columnconfigure(0, weight=1) fenetre.rowconfigure(0, weight=1) self.Titre = Label(self.main, text="Bienvenue dans Thot", font=("Times New Roman", 32), bg='#FEFEFE', fg='#850606') self.Titre.pack(side=TOP) self.fenIntro = Label(self.main, text="Un logiciel de traitement de text indépendant et surtout libre.", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.fenIntro.pack(side=TOP) self.cadreDoc = Frame(self.main, bg='#E0CDA9') self.cadreDoc.pack(expand=YES) self.cadreDocTitre = Label(self.cadreDoc, text="Document", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.cadreDocTitre.pack(side=TOP) self.docs = ["Brouillon", "Compte-rendu, résumé, synthèse", "Devoirs de maths ou une autre science", "Devoirs littéraire ou d'histoire", "Lettre", "Rapports, thèse"] self.docsB = list() for i, doc in enumerate(self.docs): self.docsB.append(Button(self.cadreDoc, text=doc, font=('Times New Roman', 16), bg="#000000", fg='#FEFEFE')) self.docsB[i].pack() self.cadreMuse = Frame(self.main, bg='#E1CE9A') self.cadreMuse.pack(expand=YES) self.cadreMuseTitre = Label(self.cadreMuse, text="Muse", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.cadreMuseTitre.pack(side=TOP) self.muses = ["Film", "Court-métrage", "Vidéo", "Pub", "Livre", "Roman", "Nouvelle", "Pièce de théâtre", "Jeu"] self.musesF = [lambda: film.Film(self), lambda: cm.CM(self), lambda: video.Video(self), lambda: pub.Pub(self), lambda: livre.Livre(self), lambda: roman.Roman(self), lambda: nouvelle.Nouvelle(self), lambda: theatre.Theatre(self), lambda: jeu.Jeu(self)] self.musesB = list() for i, muse in enumerate(self.muses): self.musesB.append(Button(self.cadreMuse, text=muse, command=self.musesF[i], font=('Times New Roman', 16), bg="#000000", fg='#FEFEFE')) self.musesB[i].pack() self.cadreMuseTitre2 = Label(self.cadreMuse, text="Élément histoire", font=("Times New Roman", 16), bg='#FEFEFE', fg='#000000') self.cadreMuseTitre2.pack() self.muses2 = ["Personnage"] self.muses2B = list() for i, muse in enumerate(self.muses2): self.muses2B.append(Button(self.cadreMuse, text=muse, font=('Times New Roman', 16), bg="#000000", fg='#FEFEFE')) self.muses2B[i].pack()
def test_inversion(): for i in range(1, 4000): assert_equal(int(roman.Roman(i)), i)
def test_to_integer(): """Roman(numeral) converts to the right integer.""" for numeral, value in known_numerals: assert_equal(int(roman.Roman(numeral)), value)
def test_from_integer(): """Roman(integer) makes a correct numeral.""" for numeral, value in known_numerals: assert_equal(str(roman.Roman(value)), numeral)