예제 #1
0
    def test_fact(self):
	self.assertEqual(main.fact(3), 6, 'factorial fail')
예제 #2
0
 def test_fact(self):
     assert fact(0) == 1
     assert fact(1) == 1
     assert fact(6) == 2 * 3 * 4 * 5 * 6
예제 #3
0
button_div.grid(column=1, row=1, padx=1, pady=1)

button_mul = Button(frame2,
                    text='X',
                    fg='maroon',
                    bg='gray75',
                    font=('comicsans', 12))
button_mul.config(width=6, height=2, command=lambda: main.mul(text_output))
button_mul.grid(column=2, row=1, padx=1, pady=1)

button_fact = Button(frame2,
                     text='!',
                     fg='maroon',
                     bg='gray75',
                     font=('comicsans', 12))
button_fact.config(width=6, height=2, command=lambda: main.fact(text_output))
button_fact.grid(column=3, row=1, padx=1, pady=1)

#3.riadok

button_7 = Button(frame2,
                  text='7',
                  fg='black',
                  bg='gray83',
                  font=('comicsans', 12))
button_7.config(width=6,
                height=2,
                command=lambda: main.digit(text_input, 7, text_output))
button_7.grid(column=0, row=2, padx=1, pady=1)

button_8 = Button(frame2,
예제 #4
0
 def test_fact2(self):
     fact(-1)
예제 #5
0
 def test_fact(self):
     self.assertEqual(main.fact(3), 6, 'factorial fail')