def test_add_strings(self): """ Test the addition of two strings returns the two string as one concatenated string """ result = my_math.add('abc', 'def') self.assertEqual(result, 'abcdef')
def test_add_integers(self): """ Test that the addition of two integers returns the correct total """ result = my_math.add(1, 2) self.assertEqual(result, 3)
import my_math my_math.add(5, 2) #when you are using command import, it run also the impotred module. #How to solve this?
# import my_math; from my_math import add; # print(my_math.add(2,4)) print(add(3,4)) from my_math import sub as subtract from my_math import * as obj; from my_math import mul, add print(subtract(2,5)) print("Hello")
def test_add(): assert my_math.add(7, 3) == 10 assert my_math.add(7, -1) == 6 assert my_math.add(4.3, 5.3) == 9.6
import my_math # Call C++ ops. print(my_math.add(1, 2)) print(my_math.subtract(1, 2)) # Call python op. print(my_math.multiply(1, 2))
def test_add_integers(self): result = my_math.add(1, 2) self.assertEqual(result, 3)
def test_add(): assert my_math.add(1, 2) == 3 assert my_math.add(99, 1) == 100
def test_add(): assert my_math.add(7, 3) == 10 assert my_math.add(-2, 2) == 0 assert my_math.add(10, -3) == 7
# this program is used for exercise module import my_math print my_math.add(1, 2, 3) print my_math.sub(10, 9, my_math.add(7, 8)) print my_math.mul(1, 2)
def test_add(): # konwencja nazwa test_nazwafunkcji assert my_math.add(7, 3) == 10 assert my_math.add(7, -1) == 6 assert my_math.add(4.3, 5.3) == 9.6
def test_add(): # zgrupowanie assercji w funkcji (funkcję trzeba wywołać) assert my_math.add(7, 3) == 10 assert my_math.add(10, 3) == 13 assert my_math.add(20, 50) == 70
import a import my_math import random print(my_math.add(5, 6)) print(my_math.mul(2, 64))
import my_math age = my_math.add(30,5) height = my_math.subtract(78, 4) weight = my_math.multiply(90, 2) iq = my_math.divide(100, 2) print("Age: %d, height: %d, weight: %d, iq: %d" % (age, height, weight, id))
import a from my_math import add, mul #import my_math #print(my_math.add(2,3)) #print(my_math.mul(2,3)) print(add(2, 3)) print(mul(2, 3)) import random #컨트롤 누르고 명령어 누르면 상세보기 나옴
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 13 14:52:52 2018 @author: student """ import my_math if __name__ == '__main__': x = input('Enter a number: ') y = input('Enter another number: ') x = my_math.convert_to_int(x) y = my_math.convert_to_int(y) print(my_math.add(x, y)) print("dac_sample_prog", __name__)
import my_math sum = my_math.add(5, 10) print('age: %d' % (sum))
def test_add(): # test jednostkowy assert my_math.add(4, 5) == 20 assert my_math.add(6, 6) == 12 assert my_math.add(6, 7) == 13
import my_math a = 5 b = 8 c = my_math.add(a, b) print(c)
def test_add(): expected = 7 ret = math.add(2, 5) assert ret == expected
def test_add_floats(self): result = my_math.add(10.5, 2) self.assertEqual(result, 12.5)
def test_add2(): expected = -3 ret = math.add(2, -5) assert ret == expected
import a import my_math print(my_math.add(2, 3)) print(my_math.mul(2, 3))
def test_add_floats(self): """ Test that the addition of two floats returns the correct result """ result = my_math.add(10.5, 2.0) self.assertEqual(result, 12.5)
from my_math import add age = add(30, 5) print(" Tuoi:", age)
def testxxx(self): total =my_math.add(1,2) self.assertEqual(total,3)