Example #1
0
 def test_sub(self):
     self.assertEqual(calc.sub(3, 4), -1)
Example #2
0
 def test_sub(self):
     result = calc.sub(100, 50)
     self.assertEqual(result, 50)
Example #3
0
 def test_sub(self):
     self.assertEqual(calc.sub(5, 1), 4)
 def test_sub(self):
     self.assertEqual(calc.sub(1, 0), 1)
     self.assertEqual(calc.sub(1, 1), 0)
     self.assertEqual(calc.sub(1, -1), 2)
     self.assertEqual(calc.sub(-1, -1), 0)
from calc import add

print(add(1, 2))

# リスト5.14 インポート対象に別名をつける¶

import calc as c

print(c.add(1, 2))

# リスト5.15 複数の対象をインポート

from calc import add, sub

print(add(1, 2))
print(sub(2, 1))

# リスト5.16 括弧を使った複数のインポート
from calc import (
    add,
    sub,
)

# リスト5.17 datetime.date()コンストラクタ

import datetime
d = datetime.date(2016, 12, 23)
print(d.year, d.month, d.day)

# リスト5.18 datetime.date.today()メソッド
 def test_sub_string_2(self):
     self.assertEqual('Invalid input', calc.sub('1', 1))
Example #7
0
#!/usr/bin/python

import calc

calc.add(5,6)
calc.sub(9,6)
Example #8
0
from calc import(
    add
   ,sub
)
print sub(10, 2) - add(3, 3)
Example #9
0
from calc import soma, sub, mult

print(soma(3, 3), sub(3, 3), mult(3, 3))
Example #10
0
def  test_sub():
	if calc.sub(4,2) == 2:
		print('test sub()(a,b) is OK')
	else:
		print('test sub(a,b,) is Fail')
Example #11
0
 def test_sub(self):
     r = calc.sub(4, 3)
     self.assertEqual(r, 1)
Example #12
0
def main():
    x = add(3, sub(7, 2))
    x = x / 2
    return x
    return a - b


import calc

calc.add(1, 2)

from calc import add

add(1, 2)

from calc import add, sub

add(1, 2)

sub(2, 1)

from calc import (
    add,
    sub,
)

import datetime

d = datetime.date(2016, 12, 23)
print(d.year, d.month, d.day)

today = datetime.date.today()
print(today)

birthday = datetime.date(2008, 12, 3)
Example #14
0
 def test_sub_2arg(self):
     # Make sure 4 - 3 = 1
     self.assertEqual(sub(4, 3), 1, 'subtracting three from four')
 def test_sub_float(self):
     self.assertEqual(1.1, calc.sub(3.2, 2.1))
Example #16
0
import calc
import sys

astr1 = int(sys.argv[1])
astr2 = int(sys.argv[2])
ind1 = int(sys.argv[3])
astria_score = calc.add(astr1, astr2)
win_score = calc.sub(astria_score, ind1)
print("From epc:", __name__)
print("Indian has to socre ", win_score + 1, " to win")
 def test_sub_negative(self):
     self.assertEqual(5, calc.sub(3, -2))
Example #18
0
 def test_sub(self):
     self.assertEqual(calc.sub(10, 5), 5)
     self.assertEqual(calc.sub(-1, -1), 0)
     self.assertEqual(calc.sub(-1, 1), -2)
Example #19
0
 def test_sub_3arg_zeroes(self):
     self.assertEqual(sub(0, 0, 0), 0, 'zero minus zero minus zero is zero')
 def test_sub(self):
     self.assertEqual(calc.sub(10, 5), 5)
     self.assertEqual(calc.sub(-5, 5), -10)
     self.assertEqual(calc.sub(10, -5), 15)
Example #21
0
def test_Sub():
    value = calc.sub(NUMBER_1, NUMBER_2)
    assert value == -30
Example #22
0
 def test_subtraction(self):
     assert 2 == calc.sub(4, 2)
Example #23
0
import calc
#相当于调用calc里面的函数
#可以理解为是命名空间
#calc.py这个文件必须放在当前目录中,或者系统目录中
print(calc.add.__doc__)  #查看文档
help(calc.add)  #查看文档,更加规范
print(calc.add(10, 20))
print(calc.divide(10, 20))
print(calc.mul(10, 20))
print(calc.sub(10, 20))
Example #24
0
# -*- coding: utf-8 -*-
"""
Created on Sun Jan  7 19:46:18 2018

@author: ramesh
"""

from calc import add, sub
print(add(4, 5))
print(sub(6, 4))
print(add(4, 5) - sub(6, 4))
Example #25
0
 def test_sub(self):
   assert 1 == calc.sub(3,2);
Example #26
0
import calc

print(type(calc))

print(calc.add(10, 20))


# from 키워드
print("\n# from 키워드")

from calc import add, sub

a = add(10, 20)
print("add = {}".format(a))

b = sub(20, 10)
print("sub = {}".format(b))


# 1.2 다양한 방식으로 불러오기
print("\n[ 1.2 다양한 방식으로 불러오기 ] ──────────────────────────────────────────────────────────────────────────\n")

# 모듈에 있는 전체를 가져오기.

from calc import *


print(mul(10, 10))


'''
def calculator():
    add=calc.add(a,b)
    sub=calc.sub(a,b)
    mul=calc.mul(a,b)
    div=calc.div(a,b)
    return render_template('calc.html', add=add, sub=sub,mul=mul,div=div)
Example #28
0
 def testSub(self):
     self.assertEqual(calc.sub(10, 3), 7)
Example #29
0
def test_sub():
    if calc.sub(4, 2) == 2:
        print("Test sub(a, b) is OK")
    else:
        print("Test sub(a, b) is Fail")
Example #30
0
 def test_sub(self):
     assert (sub(6, 5) == 1)
     assert (sub(-1, 1) == -2)
     assert (sub(1.5, 9.5) == -8.0)
     assert (sub(-1.5, -9.5) == 8.0)
     assert (sub('10', '0') == 10)
 def test_sub(self):
     self.assertEqual(1, calc.sub(3, 2))
Example #32
0
from calc import soma, sub

print('Soma', soma(3, 2))
print('Subtração', sub(3, 2))
 def test_sub_zero(self):  # Subzero!
     self.assertEqual(1, calc.sub(1, 0))
Example #34
0
import calc

print(calc.sum(12, 13))
print(calc.sub(24, 24))
print(calc.mul(4, 5))
print(calc.div(10, 2))
 def test_sub_string(self):
     self.assertEqual('Invalid input', calc.sub(1, '1'))
Example #36
0
def test_sub(a, b, esp):
    assert sub(a, b) == esp
 def test_sub2(self):
     self.assertEqual(0.2, calc.sub(0.3, 0.1))
Example #38
0
 def test_sub_3arg(self):
     self.assertEqual(sub(4, 3, 1), 0,
                      'subtracting three and one from four')