How to use test_example method in Slash

Best Python code snippet using slash

viewmodel_unittests.py

Source:viewmodel_unittests.py Github

copy

Full Screen

1import unittest2from debt_expenses.viewmodel.debt_viewmodel import DebtViewModel3class TestDebtExpensesViewModel(unittest.TestCase):4 def test_by_default_error_is_true(self):5 test_example = DebtViewModel()6 self.assertEqual('Please enter data', test_example.get_error_message())7 def test_when_enter_data(self):8 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)9 self.assertTrue('Normal work', test_example.get_error_message())10 def test_when_req_sum_incorrect(self):11 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)12 test_example.set_req_sum(-10)13 self.assertTrue('Error: Incorrect input', test_example.get_error_message())14 def test_when_percent_rate_incorrect(self):15 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)16 test_example.set_percent_rate(0)17 self.assertTrue('Error: Incorrect input', test_example.get_error_message())18 def test_when_year_incorrect(self):19 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)20 test_example.set_year(7)21 self.assertTrue('Error: Incorrect input', test_example.get_error_message())22 def test_when_period_incorrect(self):23 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)24 test_example.set_period(-5)25 self.assertTrue('Error: Incorrect input', test_example.get_error_message())26 def test_when_all_incorrect(self):27 test_example = DebtViewModel(req_sum='@@', percent_rate=-55, period=44, year=-000)28 self.assertTrue('Error: Incorrect input', test_example.get_error_message())29class TestEqualAmountsRepaymentViewModel(unittest.TestCase):30 def test_equal_amounts_repayment_for_1_year(self):31 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=1)32 test_example.perform_repayment('equal_amounts')33 payment = test_example.get_payment()34 expenses = test_example.get_expenses()35 answer = 'Payment: 78000 - Expenses: 50000'36 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))37 def test_equal_amounts_repayment_for_2_year(self):38 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=2)39 test_example.perform_repayment('equal_amounts')40 payment = test_example.get_payment()41 expenses = test_example.get_expenses()42 answer = 'Payment: 71000 - Expenses: 50000'43 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))44 def test_equal_amounts_repayment_for_3_year(self):45 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=3)46 test_example.perform_repayment('equal_amounts')47 payment = test_example.get_payment()48 expenses = test_example.get_expenses()49 answer = 'Payment: 64000 - Expenses: 50000'50 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))51 def test_equal_amounts_repayment_for_4_year(self):52 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)53 test_example.perform_repayment('equal_amounts')54 payment = test_example.get_payment()55 expenses = test_example.get_expenses()56 answer = 'Payment: 57000 - Expenses: 50000'57 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))58class TestEqualPaymentsRepaymentViewModel(unittest.TestCase):59 def test_equal_payments_repayment_for_1_year(self):60 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=1)61 test_example.perform_repayment('equal_payments')62 payment = test_example.get_payment()63 expenses = test_example.get_expenses()64 answer = 'Payment: 68641 - Expenses: 40641'65 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))66 def test_equal_payments_repayment_for_2_year(self):67 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=2)68 test_example.perform_repayment('equal_payments')69 payment = test_example.get_payment()70 expenses = test_example.get_expenses()71 answer = 'Payment: 68641 - Expenses: 46331'72 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))73 def test_equal_payments_repayment_for_3_year(self):74 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=3)75 test_example.perform_repayment('equal_payments')76 payment = test_example.get_payment()77 expenses = test_example.get_expenses()78 answer = 'Payment: 68641 - Expenses: 52817'79 self.assertEqual(answer, 'Payment: {:.0f} - Expenses: {:.0f}'.format(payment, expenses))80 def test_equal_payments_repayment_for_4_year(self):81 test_example = DebtViewModel(req_sum=200000, percent_rate=0.14, period=4, year=4)82 test_example.perform_repayment('equal_payments')83 payment = test_example.get_payment()84 expenses = test_example.get_expenses()85 answer = 'Payment: 68641 - Expenses: 60211'...

Full Screen

Full Screen

unittests.py

Source:unittests.py Github

copy

Full Screen

1import unittest2from debt_expenses.debt import DebtExpenses3class TestDebtExpenses(unittest.TestCase):4 def test_equal_amounts_repayment_with_invalid_req_sum(self):5 with self.assertRaises(ValueError):6 DebtExpenses(-333, 0.14, 4)7 def test_equal_amounts_repayment_with_invalid_percent_rate(self):8 with self.assertRaises(ValueError):9 DebtExpenses(200000, -0.14, 4)10 def test_equal_amounts_repayment_with_invalid_period(self):11 with self.assertRaises(ValueError):12 DebtExpenses(200000, 0.14, -4)13 def test_equal_amounts_repayment_with_all_invalid_values(self):14 with self.assertRaises(ValueError):15 DebtExpenses(-200000, -0.14, -4)16 def test_equal_amounts_repayment_with_invalid_type_req_sum(self):17 with self.assertRaises(TypeError):18 DebtExpenses(13823.4566, 0.14, 4)19 def test_equal_amounts_repayment_with_invalid_type_period(self):20 with self.assertRaises(TypeError):21 DebtExpenses(200000, 0.14, 4.5)22 def test_equal_amounts_repayment_with_invalid_type_percent_rate(self):23 with self.assertRaises(TypeError):24 DebtExpenses(200000, '0.14', 4)25class TestEqualAmountsRepayment(unittest.TestCase):26 def test_equal_amounts_repayment_for_1_year(self):27 test_example = DebtExpenses(200000, 0.14, 4)28 payment, expenses = test_example.equal_amounts_repayment(1)29 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['78000', '50000'])30 def test_equal_amounts_repayment_for_2_year(self):31 test_example = DebtExpenses(200000, 0.14, 4)32 payment, expenses = test_example.equal_amounts_repayment(2)33 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['71000', '50000'])34 def test_equal_amounts_repayment_for_3_year(self):35 test_example = DebtExpenses(200000, 0.14, 4)36 payment, expenses = test_example.equal_amounts_repayment(3)37 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['64000', '50000'])38 def test_equal_amounts_repayment_for_4_year(self):39 test_example = DebtExpenses(200000, 0.14, 4)40 payment, expenses = test_example.equal_amounts_repayment(4)41 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['57000', '50000'])42 def test_equal_amounts_repayment_for_all_years(self):43 test_example = DebtExpenses(200000, 0.14, 4)44 req_sum = 045 for i in range(1, 5, 1):46 _, expenses = test_example.equal_amounts_repayment(i)47 req_sum += expenses48 self.assertEqual(format(req_sum, '.0f'), '200000')49 def test_equal_amounts_repayment_for_invalid_pos_year(self):50 test_example = DebtExpenses(200000, 0.14, 4)51 with self.assertRaises(Exception):52 test_example.equal_amounts_repayment(6)53 def test_equal_amounts_repayment_for_invalid_neg_year(self):54 test_example = DebtExpenses(200000, 0.14, 4)55 with self.assertRaises(Exception):56 test_example.equal_amounts_repayment(-6)57class TestEqualPaymentsRepayment(unittest.TestCase):58 def test_equal_payments_repayment_for_1_year(self):59 test_example = DebtExpenses(200000, 0.14, 4)60 payment, expenses = test_example.equal_payments_repayment(1)61 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['68641', '40641'])62 def test_equal_payments_repayment_for_2_year(self):63 test_example = DebtExpenses(200000, 0.14, 4)64 payment, expenses = test_example.equal_payments_repayment(2)65 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['68641', '46331'])66 def test_equal_payments_repayment_for_3_year(self):67 test_example = DebtExpenses(200000, 0.14, 4)68 payment, expenses = test_example.equal_payments_repayment(3)69 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['68641', '52817'])70 def test_equal_payments_repayment_for_4_year(self):71 test_example = DebtExpenses(200000, 0.14, 4)72 payment, expenses = test_example.equal_payments_repayment(4)73 self.assertEqual([format(payment, '.0f'), format(expenses, '.0f')], ['68641', '60211'])74 def test_equal_payments_repayment_for_all_years(self):75 test_example = DebtExpenses(200000, 0.14, 4)76 req_sum = 077 for i in range(1, 5, 1):78 _, expenses = test_example.equal_payments_repayment(i)79 req_sum += expenses80 self.assertEqual(format(req_sum, '.0f'), '200000')81 def test_equal_payments_repayment_for_invalid_pos_year(self):82 test_example = DebtExpenses(200000, 0.14, 4)83 with self.assertRaises(Exception):84 test_example.equal_payments_repayment(6)85 def test_equal_payments_repayment_for_invalid_neg_year(self):86 test_example = DebtExpenses(200000, 0.14, 4)87 with self.assertRaises(Exception):...

Full Screen

Full Screen

test_examples.py

Source:test_examples.py Github

copy

Full Screen

1from tests.fixtures import ExecutedTestsBase2class PrimitiveTests(ExecutedTestsBase):3 def test_from_points(self):4 from examples.primitive import from_points as test_example5 self.run_and_check(test_example)6class OperationTests(ExecutedTestsBase):7 def test_extrude(self):8 from examples.operation import extrude as test_example9 self.run_and_check(test_example)10 def test_loft(self):11 from examples.operation import loft as test_example12 self.run_and_check(test_example)13 14 def test_revolve(self):15 from examples.operation import revolve as test_example16 self.run_and_check(test_example)17 18 def test_wedge(self):19 from examples.operation import wedge as test_example20 self.run_and_check(test_example)21 22 def test_airfoil2d(self):23 from examples.operation import airfoil_2d as test_example24 self.run_and_check(test_example)25class ShapeTests(ExecutedTestsBase):26 def test_elbow(self):27 from examples.shape import elbow as test_example28 self.run_and_check(test_example)29 30 def test_frustum(self):31 from examples.shape import frustum as test_example32 self.run_and_check(test_example)33 34 def test_extruded_ring(self):35 from examples.shape import extruded_ring as test_example36 self.run_and_check(test_example)37 def test_revolved_ring(self):38 from examples.shape import revolved_ring as test_example39 self.run_and_check(test_example)40 def test_hemisphere(self):41 from examples.shape import hemisphere as test_example42 self.run_and_check(test_example)43 def test_frustum_wall(self):44 from examples.shape import frustum_wall as test_example45 self.run_and_check(test_example)46 def test_elbow_wall(self):47 from examples.shape import elbow_wall as test_example48 self.run_and_check(test_example)49class ChainingTests(ExecutedTestsBase):50 def test_flywheel(self):51 from examples.chaining import flywheel as test_example52 self.run_and_check(test_example) 53 def test_tank(self):54 from examples.chaining import tank as test_example55 self.run_and_check(test_example) 56 def test_test_tube(self):57 from examples.chaining import test_tube as test_example58 self.run_and_check(test_example) 59 def test_venturi_tube(self):60 from examples.chaining import venturi_tube as test_example61 self.run_and_check(test_example) 62 def test_orifice_plate(self):63 from examples.chaining import orifice_plate as test_example64 self.run_and_check(test_example) 65 def test_coriolis_flowmeter(self):66 from examples.chaining import coriolis_flowmeter as test_example67 self.run_and_check(test_example)68class ComplexTests(ExecutedTestsBase):69 def test_helmholtz_nozzle(self):70 from examples.complex import helmholtz_nozzle as test_example71 self.run_and_check(test_example)72 73 def test_karman(self):74 from examples.complex import karman as test_example75 self.run_and_check(test_example)76class AdvancedTests(ExecutedTestsBase):77 def test_project(self):78 from examples.advanced import project as test_example79 self.run_and_check(test_example)80 def test_sphere(self):81 from examples.advanced import sphere as test_example82 self.run_and_check(test_example)83 def test_merged(self):84 from examples.advanced import merged as test_example...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful