def test_310_str2(self): print "test3" print self.user_inst a="str1" b=10 act=add(a,b) exp=None self.assertEqual(act, exp, "%s, %s test failed"%(a,b))
def test_110_20(self): print "test1" print self.user_inst a=10 b=20 act=add(a,b) exp=30 self.assertEqual(act, exp, "%s,%s test failed"%(a,b))
def test_2str1_str2(self): print "test2" print self.user_inst a="str1" b="str2" act=add(a,b) exp="str1str2" self.assertEqual(act, exp, "%s, %s test failed"%(a,b))
def test_add(self): test_number_a = 3 test_number_b = 6 test_result = 9 result = add(test_number_a, test_number_b) self.assertEqual(result, test_result)
def test_user(self): for test in self.failure_test_params: adding_user = add(test[USERNAME_INPUT], test[USERS_INPUT]) actual_result = adding_user expected_result = test[EXPECTED_OUTPUT] #self.assertNotEqual(len(actual_result), len(expected_result)) self.assertNotEqual(actual_result, expected_result) self.assertNotEqual(actual_result['player'], expected_result['player'])
def test1(self): self.assertEqual(add(1,1), 2)
def test_add_not_num2(self): actual = app.add(1, None)
def test_add_nums(self): actual = app.add(1, 10) assert actual == 11
#__author: "Jing Xu" #date: 2018/1/23 import app import sys print(app.add(1, 4)) print(sys.path)
def test_addition(self): assert 4 == app.add(2, 2)
def test_add(self): self.assertEqual(app.add(3, 4), 7)
def test_add(x, y, result): assert add(x, y) == result
def test_add(self): self.assertEqual(app.add(10, 5), 15) self.assertEqual(app.add(-2, 2), 1)
def test_str1_20(self): print("this istest_str1_20 ") print(self.user) act = add("str1", 20) exp = None self.assertEqual(act, exp, "test_str1_20 failed")
def test_app1(): assert type(add(10, 20)) == type('')
def test_add(): assert 2 == add(1, 1)
def test_add(self): self.assertEqual(app.add(10, 5), 15) self.assertEqual(app.add(-1, 1), 0) self.assertEqual(app.add(-1, -1), -2)
import app exp = 30 act = app.add(10, 20) if exp == act: print "test passed" else: print "text not passed" exp = "str1str2" act = app.add("str1", "str2") if exp == act: print "test passed" else: print "text not passed" exp = None act = app.add("str1", 123) if exp == act: print "test passed" else: print "text not passed"
def test_app_add(): assert app.add(0, 1) == 1
def test_app2(): assert add(200, 300) == '500'
import app assert app.add(10, 20) == 30 assert app.add(10, 20, 5) == 35 assert app.mul(5, 2) == 10 assert app.mul(5, 2, 2) == 20
def test_10_20(self): print("this is test_10_20") print(self.user) act = add(10, 20) exp = 30 self.assertEqual(act, exp, "test_10_20 failed")
def test_add(self): self.assertEqual(calculations.add(1,2), 3) self.assertEqual(calculations.add(2,1), 3) self.assertEqual(calculations.add(0,2), 2) self.assertEqual(calculations.add(1,-1), 0)
def test_10_str2(self): print("this test_10_str2 ") print(self.user) act = add(10, "str2") exp = None self.assertEqual(act, exp, "test_10_str2 failed")
import app a = 10 b = 20 act = app.add(a, b) exp = 300 if act != exp: print a, b, "test vase failed" a = "str1" b = "str2" act = app.add(a, b) exp = "str1str2" if act != exp: print a, b, "test vase failed" a = [1, 2, 3] b = [4, 5, 6] act = app.add(a, b) exp = [1, 2, 3, 4, 5, 6] if act != exp: print a, b, "test vase failed" a = 10 b = "str1" act = app.add(a, b) exp = None if act != exp: print a, b, "test vase failed"
def test_app(): assert app.add(2, 3) == 5
import tkinter def main(): calc = tkinter.Tk() calc.title("Aiden Calculator") # Width, height in pixels f1 = Frame(calc, height=50, width=50) f1.pack() calc.mainloop() main() num1 = float(input("first number: ")) operator = input("select operator: ") # + - * / num2 = float(input("second number: ")) if operator == "+": ans = add(num1, num2) if operator == "-": ans = sub(num1, num2) if operator == "*": ans = mul(num1, num2) if operator == "/": ans = div(num1, num2) print(round(ans, 10))
def test_add(self): self.assertEqual(app.add(self.x, self.y), 15) self.assertEqual(app.add(2, 3), 5)
def test_add_not_num1(self): actual = app.add(None, 10)
def test_add(): assert app.add(3, 6) == 9