Published 2021. 1. 6. 10:51
# calculator.py
class Calculator(object):
    """Calculator class"""
    def __init__(self):
        pass

    @staticmethod
    def add(a, b):
        return a + b

    @staticmethod
    def subtract(a, b):
        return a - b

    @staticmethod
    def multiply(a, b):
        return a * b

    @staticmethod
    def divide(a, b):
        return a / b

 

이 계산기 클래스의 모든 함수에 대해서 테스팅 코드를 작성해야 한다면, 다음과 같이 작성할 수 있을 것입니다.

 

 

복사했습니다!