def setUp(self): """ set up fixture """ db.connect() db.create_tables([JTF2, CSOR]) self.OR1 = OR() self.CSOR1 = CSOR(_SIN='A23456789', _rank='General', _lname='Hashimi', _fname='Shabnam', DIVISION='CSOR', _training_pay=500, _deployment_pay=900, _trainings='Training1', _section_call_sign='ABC', _kill_count=3) self.CSOR1.save() self.JTF2_1 = JTF2(_SIN='A55555555', _rank='General', _lname='Chalamet', _fname='Timothee', DIVISION='JTF2', TRAINING_PAY=350, DEPLOYMENT_PAY=700, _trainings='Training1', _role='Leader', _missions=2) self.JTF2_1.save() self.JTF2_2 = JTF2(_SIN='A00000000', _rank='Soldier', _lname='Prinze Jr.', _fname='Freddie', DIVISION='JTF2', TRAINING_PAY=350, DEPLOYMENT_PAY=700, _trainings='Training1', _role='Sniper', _missions=2) self.JTF2_2.save() self.OP1 = Operation('Indigo', 'Afghanistan')
def testOperations(self): @Operations.Method(Operations.GET) def testMethod(): pass # test Operations.Method soln = Operation() soln.setMethod(Operations.GET) self.assertEqual(testMethod.operation, soln) @Operations.Nickname('nickname') def testNickname(): pass soln = Operation() soln.setNickname('nickname') self.assertEqual(testNickname.operation, soln) @Operations.Type('type') def testType(): pass soln = Operation() soln.setObject('type') self.assertEqual(testType.operation, soln) @Operations.Summary('summary') def testSummary(): pass soln = Operation() soln.setSummary('summary') self.assertEqual(testSummary.operation, soln) @Operations.Notes('notes') def testNotes(): pass soln = Operation() soln.setNotes('notes') self.assertEqual(testNotes.operation, soln)
def operate(self): op = Operation(); op.scan(self.question)
def test_positive_negative_integer_divide(self): """Testing division of positive and negative integers""" new_operation = Operation("division", self.positive_integer, self.negative_integer) self.assertEqual(new_operation.operation_result(), -1.0227272727272727)
def test_positive_integer_float_divide(self): """Testing division of positive integer and float""" new_operation = Operation("division", self.positive_integer, self.positive_float) self.assertEqual(new_operation.operation_result(), 1.9580558333094016)
def test_positive_negative_integer_multiply(self): """Testing multiplication of positive and negative integers""" new_operation = Operation("multiplication", self.positive_integer, self.negative_integer) self.assertEqual(new_operation.operation_result(), -7920)
def test_positive_integer_float_multiply(self): """Testing multiplication of positive integer and float""" new_operation = Operation("multiplication", self.positive_integer, self.positive_float) self.assertEqual(new_operation.operation_result(), 4136.7564)
def test_positive_integer_float_subtract(self): """Testing subtract of positive integer and float""" new_operation = Operation("subtraction", self.positive_integer, self.positive_float) self.assertEqual(new_operation.operation_result(), 44.03604)
def test_positive_negative_integer_subtract(self): """Testing subtract of positive and negative integers""" new_operation = Operation("subtraction", self.positive_integer, self.negative_integer) self.assertEqual(new_operation.operation_result(), 178)
def test_positive_integer_float_sum(self): """Testing sum of positive integer and float""" new_operation = Operation("addition", self.positive_integer, self.positive_float) self.assertEqual(new_operation.operation_result(), 135.96396)
def test_positive_integer_sum(self): """Testing sum of positive integers""" new_operation = Operation("addition", self.positive_integer, self.positive_integer) self.assertEqual(new_operation.operation_result(), 180)
def button_equal(self): second_number = int(self.e.get()) self.e.delete(0, END) new_result = Operation(self.math, self.f_num, second_number) self.e.insert(0, new_result.operation_result())