コード例 #1
0
 def calculate_string_1_plus_1_should_be_2_test(self):
     assert Calculator("1+1").calculate() == 2
コード例 #2
0
 def calculate_string_4_minus_3_should_be_1_test(self):
     assert Calculator("4-3").calculate() == 1
コード例 #3
0
 def define_operator_1_minus_1_should_be_minus_test(self):
     assert Calculator("1-1").define_operator() == "-"
コード例 #4
0
 def define_operator_1_1_should_be_none_test(self):
     assert Calculator("11").define_operator() == None
コード例 #5
0
 def calculate_list_of_1_minus_1_int_should_be_2_test(self):
     assert Calculator("1-1").calculate_list_int([1, 1]) == 0
コード例 #6
0
 def define_operator_1_plus_1_should_be_plus_test(self):
     assert Calculator("1+1").define_operator() == "+"
コード例 #7
0
 def split_5_minus_6_should_be_list_of_5_6_test(self):
     assert Calculator("5-6").split_by_minus() == ['5', '6']
コード例 #8
0
 def convert_list_of_1_1_string_to_1_1_int_test(self):
     assert Calculator("1+1").convert_list_string_to_int(['1',
                                                          '1']) == [1, 1]
コード例 #9
0
 def split_3_minus_4_should_be_list_of_3_4_test(self):
     assert Calculator("3-4").split_by_minus() == ['3', '4']
コード例 #10
0
 def split_1_minus_2_should_be_list_of_1_2_test(self):
     assert Calculator("1-2").split_by_minus() == ['1', '2']
コード例 #11
0
 def split_3_plus_5_should_be_list_of_3_5_test(self):
     assert Calculator("3+5").split_by_plus() == ['3', '5']
コード例 #12
0
 def split_1_plus_1_should_be_list_of_1_1_test(self):
     assert Calculator("1+1").split_by_plus() == ['1', '1']
コード例 #13
0
from simple_calculator.calculator import Calculator

calculator = Calculator()


def test_add_two_numbers():
    assert calculator.add(1, 2) == 3


def test_add_many_numbers():
    assert calculator.add(1, 2, 3, 4, 5) == 15


def test_multiply_two_numbers():
    assert multiply(1, 3) == 3


def test_multiply_many_numbers():
    assert multiply(1, 2, 3, 4, 5) == 120