Пример #1
0
 def test_add(self, steps, num1, num2):
     with steps.start('Add'):
         assert add(num1, num2) == num1 + num2
     with steps.start('Result > 0'):
         try:
             assert add(num1, num2) > 0
         except AssertionError:
             self.skipped('Result < 0)')
Пример #2
0
def main():
    inventory = (calculation.load_from_file())

    while True:
        userInput = input(
            "Choices:\n[H] for [H]elp on information how to Add or Sell items.\n[A] and amount to [A]dd.\n[S] and amount to [S]ell\n[L] to [L]ist current stock\n[x] for E[x]it.\nEnter command: "
        )
        userInput = userInput.upper().split(',')

        #On exit show current stock and break
        if userInput[0] == "X":
            current_stock(inventory)
            print("Good bye !")
            break

        elif userInput[0] == "H":
            help()

        #Show current stock
        elif userInput[0] == "L":
            current_stock(inventory)

        #On Add stock call add function from calculation module
        elif userInput[0] == "A":
            inventory = calculation.add(userInput, inventory)

        # On Sell stock call sell function from calculation module
        elif userInput[0] == "S":
            inventory = calculation.sell(userInput, inventory)
        else:
            try_again()

    #Save current inventory situation for later use
    calculation.save_to_file(inventory)
Пример #3
0
 def add_test(self, num1, num2):
     if add(num1, num2) < 0:
         self.skipped(
             'Test is skipped because of the result of the add(num1, num2) less then 0.'
         )
     else:
         self.passed(
             'Test passed because another requirements is satisfied!')
Пример #4
0
def magic_calculation(a, b):
    from calculation import add
    return add(a, b)
    return a < b
    a + b = c
    for h in range(90):
        for w in range(4, 6):
            c + i = c
Пример #5
0
 def test_add_with_zero(self):
     """Test that the addition of value with 0, returns the correct total"""
     result = calculation.add(5, 0)
     self.assertEqual(result, 5)
Пример #6
0
 def test_add_less_zero(self):
     """Test that the addition of two values less than 0, returns the correct total"""
     result = calculation.add(-2, -4)
     self.assertEqual(result, -6)
Пример #7
0
 def test_add(self):
     self.assertEqual(calculation.add(10, 5), 15)
Пример #8
0
 def test_add(self):
     result = calculation.add(5,6)
     self.assertEqual(11, result)
import calculation

a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))

print("\n Addition:",calculation.add(a,b))
print("\n Subtraction:",calculation.sub(a,b))
print("\n Multiplication",calculation.mult(a,b))
print("\n Division",calculation.div(a,b))
Пример #10
0
def test_add1():
    assert(calculation.add(5,71), 76)
Пример #11
0
def test_add():
    assert(calculation.add(5,7), 12)
Пример #12
0
 def test_add(self, num1, num2):
     """"Test addition functionality."""
     if add(num1, num2) < 0:
         self.failed(
             f'Test failed because result of adding {num1} and {num2} is less then 0'
         )
Пример #13
0
# import sys
# sys.path.append("c:\\Python_modules")

import calculation as calc
r = calc.add(2, 3)
r2 = calc.divide(4, 2)
r3 = calc.mulply(2, 2)
r4 = calc.subtract(4, 3)
print(r, r2, r3, r4)
print(dir(calc))
Пример #14
0
 def test_add(self, steps, num1, num2):
     """Test 'add' func in calculation.py.
     Test will be skipped if result less then 0 and passed in other cases"""
     with steps.start('Result bigger or equal 0'):
         if add(num1, num2) < 0:
             self.skipped('Result is less then 0)')
Пример #15
0
 def add(self, num1, num2):
     if add(num1, num2) < 0:
         self.failed('Result < 0)')
Пример #16
0
 def test_add_more_zero(self):
     """Test that the addition of two values more than 0, returns the correct total"""
     result = calculation.add(4, 5)
     self.assertEqual(result, 9)
Пример #17
0
 def test_add(self, num1, num2):
     """method for testing add function"""
     if add(num1, num2) < 0:
         self.skipped('Result of add is less then 0')
Пример #18
0
import calculation

print(calculation.add(2, 3))
print(calculation.sub(7, 3))
Пример #19
0
#from calculation import add
import calculation
print(calculation.add(1,2)) 
Пример #20
0
 def test_add(self, steps, num1, num2):
     """Test addition functionality."""
     with steps.start(f'Addition of {num1} and {num2}'):
         if add(num1, num2) < 0:
             self.skipped(f'Test was skipped because result of adding {num1} and {num2} is less then 0')