Example #1
0
 def test_add(self):
     self.assertEqual(calc.add(10.39, 20.39),30.78)
     self.assertEqual(calc.add(-10, 5),-5)
     self.assertEqual(calc.add("yes", 10),"Error")
     self.assertEqual(calc.add(10, "ten"),"Error")
     self.assertEqual(calc.add("10", 10), 20)
Example #2
0
 def test_add(self):  # first word must be 'test'
     self.assertEqual(calc.add(10, 5), 15)
     self.assertEqual(calc.add(-1, 1), 0)
     self.assertEqual(calc.add(-1, -1), -2)
def test_add():
    assert calc.add(1, 2) == 3
Example #4
0
 def test_add_2arg(self):
     # Make sure 3 + 4 = 7
     self.assertEqual(add(3, 4), 7, 'adding three and four')
 def test_add_string_2(self):
     self.assertEqual('Invalid input', calc.add('1', 1))
Example #6
0
 def test_add(self):
     self.assertEqual(calc.add(1, 1), 2)
Example #7
0
# import entire module
'''import calc

calc.add(45,34,23)
calc.div(10,5)
calc.mul(9,7)'''

#import req. functions

from calc import add
from calc import mul
add(45, 56)
mul(9, 8)

#imported functions can be renamed

from calc import div as division
division(20, 10)

#import all the functions

from calc import *

sub(7, 2)
 def test_add_negative(self):
     self.assertEqual(0, calc.add(1, -1))
Example #9
0
 def test_sum2(self):
     self.assertEqual(calc.add(5, -4), 1)
 def test_addition(self):
     """testing addition"""
     self.assertEqual(add(1, 2), 3)
Example #11
0
 def test_sum1(self):
     self.assertEqual(calc.add(5, 4), 9)
Example #12
0
 def test_add(self):
     self.assertEqual(calc.add(10,6),16)
     self.assertEqual(calc.add(-5,6),1)
     self.assertEqual(calc.add(10.8,-0.8),10)
     self.assertEqual(calc.add(-20,"a"),"DTNS")
 def testAdd(self):
     self.assertEqual(4, add(2, 2))
     self.assertEqual(2, add(0, 2))
Example #14
0
 def test_add(self):
     print 'Now test add'
     self.assertEqual(calc.add(self.num1, self.num2), 15)
from calc import add
a = 9
b = 7
c = add(a, b)
print(c)
Example #16
0
a=9
print(a)

import calc
print(calc.add(99,66))
Example #17
0
def test_add_wrong_value():
    assert add(1, 3) != 5
 def test_add_associative(self):
     self.assertEqual(calc.add(2, calc.add(3, 4)), calc.add(calc.add(2, 3), 4))
Example #19
0
def test_add_wrong_type():
    with pytest.raises(TypeError):
        add(1, "3")
 def test_add(self):
     self.assertEqual(3, calc.add(1, 2))
Example #21
0
def test_add_value():
    assert add(1, 3) == 4
Example #22
0
 def test_add(self):
     result = calc.add(10, 5)
     self.assertEquals(result, 15)
 def test_sub(self):
     self.assertEqual(calc.add(1, 5), 7)
     self.assertEqual(calc.add(3, 5), 4)
Example #24
0
 def test_add(self):
     self.assertEqual(add(-1, 1), 0)
     self.assertEqual(add(-1, -1), -2)
     self.assertEqual(add(10, 5), 15)
Example #25
0
 def test_add(self):
     # result = calc.add(10, 5)
     self.assertEqual(calc.add(10, 5), 15)
     self.assertEqual(calc.add(-1, 1), 0)
     self.assertEqual(calc.add(-1, -1), -2)
Example #26
0
 def test_add_number(self):
     self.assertEqual(add(3, 8), 11)
Example #27
0
def test_add():
    assert add(1, 2) == 3
Example #28
0
 def test_add(self):
     result = calc.add(10,5)
     self.assertEqual(result, 15)
 def test_add(self):
     self.assertEqual(calc.add(1, 2), 3)
Example #30
0
from calc import add, multi

print(add(1, 2, 3))

print(multi(2, 3))
Example #31
0
 def test_add(self, value):
     result = calc.add(value, value)
     self.assertEqual(result, 15)
Example #32
0
 def test_A(self):
     result = calc.add(5, 6)
     self.assertEqual(result, 11)
Example #33
0
 def test_add(self):
     self.assertEqual(calc.add(8, 9), 17)
     self.assertEqual(calc.add(-1, 1), 0)
     self.assertEqual(calc.add(-1, -1), -2)
 def test_add_float(self):
     self.assertEqual(2.6, calc.add(1.5, 1.1))
Example #35
0
def fun2():
    add()
    print("from fun2")
 def test_add_commutative(self):
     self.assertEqual(calc.add(2, 1), calc.add(1, 2))
Example #37
0
def fun1():
    add()
    add()
    print("from fun1")
 def test_add_string(self):
     self.assertEqual('Invalid input', calc.add(1, '1'))
Example #39
0
    def test_add(self):

        self.assertEqual(calc.add(20, 5), 25)
        self.assertEqual(calc.add(-1, 1), 0)
        self.assertEqual(calc.add(-1, -1), -2)
 def test_add2(self):
     self.assertEqual(0.3, calc.add(0.1, 0.2))
Example #41
0
import math

print(id(math))
print(type(math))
print(math)
print(math.pi)
print("-" * 50)
print(dir(math))
print(math.pow(2, 2), type(math.pow(2, 2)))
print(math.ceil(9.001))
print(math.floor(9.999))
print("-" * 50)

# import calc
from calc import add

print(add(12, 4))
# print(calc.div(12,4))
Example #42
0
import calc

print(calc.add(1, 2))

# https://qiita.com/Tocyuki/items/fb99d9bdb71875843357
Example #43
0
 def test_addition(self):
     result = calc.add(2, 3)
     self.assertEqual(5, result)
 def test_add(self):
     self.assertEqual(calc.add(10, 5), 15)
     self.assertEqual(calc.add(-1, 1), 0)
     self.assertEqual(calc.add(-1, -1), -2)
Example #45
0
def test_add(num1, num2, output):
    assert calc.add(num1, num2) == output
Example #46
0
	def test_calc_add(self):
		result = calc.add(self.a, self.b)
		self.assertEqual(result, self.a + self.b)
Example #47
0
from calc import(
    add
   ,sub
)
print sub(10, 2) - add(3, 3)