Example #1
0
 def test_operation_multiplication(self):
     operation = Operations(100, 1)
     self.assertEqual(operation.setMultiplication(), 100,
                      'Incorrect result')
Example #2
0
from player import Player

from operations import Operations

import sys

# for api-key
from decouple import config


api_key = config('API_KEY')

player = Player()

operations = Operations()

def to_shop(c_map=c_map):
    current_room = operations.init_player()

    check_inv = operations.check_status()
<<<<<<< HEAD
<<<<<<< HEAD
    #print('CHECK INVENTORY', check_inv['inventory'])

    #print(current_room, 'LOOKIE')
    #print(current_room['room_id'],current_room['title'],'NOW LOOK')
    #print(current_room['exits'], 'NOW LOOK')
    cur_room_id = current_room['room_id']
    path = to_room(c_map[cur_room_id], 105)
    # path = bfs(current room, 1(shop room))
Example #3
0
import os
from operations import Operations

print("Calculator in python")

print("\nChoice operation ")
exit = 0

while(exit == 0):
    print("1 - Addition\n2 - Subtraction\n3 - Multiplication\n4 - Division\n5 - root\n6 - potentiation")

    operator = int(input("Operator: "))
    value1 = float(input("\nValue 1: "))
    value2 = float(input("Value 2: "))

    operation = Operations(value1, value2) 

    if(operator == 1):
        operation.setAddition()
    elif(operator == 2):
        operation.setSubtraction()
    elif(operator == 3):
        operation.setMultiplication()
    elif(operator == 4):
        operation.setDivision()
    elif(operator == 5):
        operation.setRoot()
    elif(operator == 6):
        operation.setPotentiation()
    
    #os.system('cls' if os.name == 'nt' else 'clear')
Example #4
0
    def test_calculate(self):

        input_string = b'26 * 99 - 37 * 38 + 50 + 48 / 45 + 90 + 22 - 44'
        operations = Operations()
        self.assertEqual(operations.main(input_string), b'1287.0666666666666')
Example #5
0
from apscheduler.schedulers.blocking import BlockingScheduler

from operations import Operations

sched = BlockingScheduler()
ops = Operations()


@sched.scheduled_job('interval', seconds=15)
def update_15_seconds():
    print('Update device locations every 15 seconds.')
    ops.update_device_locale()


sched.start()
Example #6
0
 def test_operation_potentiation(self):
     operation = Operations(10, 1)
     self.assertEqual(operation.setPotentiation(), 100, 'Incorrect result')
Example #7
0
# Arguments
#
# python ocic-cli.py <config-file> <cmd>
#
nArgs = len(sys.argv)
if nArgs >= 3:
    configFile = sys.argv[1]
    cmd = sys.argv[2]
    config = configparser.ConfigParser()
    config.read(configFile)
else:
    cmd = "help"

if cmd == "auth":
    o = Operations()
    o.authenticate(config, show=True)
    print(o.auth)

elif cmd == "database":
    o = Operations()
    o.authenticate(config)
    r = o.databaseInstance()
    for i in r['services']:
        out = ", ".join(
            map(str, [
                i['service_name'], i['version'], i['current_version'],
                i['dbUsableStorage'], i['status'], i['sid'], i['created_by'],
                i['num_nodes'], i['edition'], i['shape'], i['rac_database']
            ]))
        print(out)
Example #8
0
 def test_operation_division(self):
     operation = Operations(100,100)
     self.assertEqual(operation.division(), 1, 'Incorrect result')
Example #9
0
 def test_avg(self):
     operation = Operations([1,2,3,4], False)
     self.assertAlmostEqual(operation.avg(), 2.5, msg='Incorrect result')
Example #10
0
 def test_must_add_value_on_credit(self):
     op = Operations("accounts.csv")
     op.accounts = {"1": 2359415, "2": 335498, "3": -5579741}  #mocking data
     original_value = op.accounts["1"]
     op.make_operation("1", 100)
     self.assertEquals(op.accounts["1"], long(original_value + 100))
Example #11
0
 def test_operation_subtraction(self):
     operation = Operations(100, 100)
     self.assertEqual(operation.subtraction(), 0, 'Incorrect result')
Example #12
0
 def test_must_apply_tax_on_negative_account(self):
     op = Operations("accounts.csv")
     op.accounts = {"1": 2359415, "2": 335498, "3": -5579741}  #mocking data
     original_value = op.accounts["3"]
     op.make_operation("3", -300)
     self.assertEquals(op.accounts["3"], long(original_value - 800))
Example #13
0
 def test_must_subtract_value_on_debit(self):
     op = Operations("accounts.csv")
     op.accounts = {"1": 2359415, "2": 335498, "3": -5579741}  #mocking data
     original_value = op.accounts["2"]
     op.make_operation("2", -200)
     self.assertEquals(op.accounts["2"], long(original_value - 200))
Example #14
0
 def test_factorial(self):
     operation = Operations(6,1)
     self.assertEqual(operation.factorial(), 720, msg='Incorrect Result')
Example #15
0
 def test_operation_division_by_zero(self):
     operation = Operations(100, 0)
     self.assertEqual(operation.setDivision(), 1, 'Incorrect result')
Example #16
0
 def test_log(self):
     operation = Operations(100,10)
     self.assertEqual(operation.log(), 2.0, msg='Incorrect result')
Example #17
0
 def test_operation_root(self):
     operation = Operations(100, 1)
     self.assertEqual(operation.setRoot(), 10, 'Incorrect result')
Example #18
0
from connection import Connection
from operations import Operations
from flask import Flask, jsonify, render_template, send_from_directory
from dotenv import load_dotenv
import os
load_dotenv()

app = Flask(__name__, static_url_path='')
connection = Connection(os.getenv('DB_HOST'), os.getenv('DB_USER'),
                        os.getenv('DB_PASSWORD'), os.getenv('DB_NAME'))
operations = Operations(connection)

__corrida_ativa = 0
__corredor_ativo = 0
__running = False

__infras = [0, 0, 0, 0, 0, 0]
__timer_infras = [0, 0, 0]
__tempos = [0, 0, 0]


@app.route("/")
def index():
    return "gravity car system"


@app.route("/ativar-corredor/<int:id_corredor>", methods=["POST"])
def ativar_corredor(id_corredor):
    global __corredor_ativo
    __corredor_ativo = id_corredor
    return "OK"
Example #19
0
 def test_operation_addition(self):
     operation = Operations(100, 100)
     self.assertEqual(operation.setAddition(), 200, 'Incorrect result')
 def test_sum(self):
     sut = Operations()
     sut.sum = MagicMock(return_value=3)
     result = sut.sum(1, 1)
     self.assertEqual(result, 3)