diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..4cb279b2621cf2c3fde6e686577063c7b6251b0a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,27 @@ +image: python:3.10 + +stages: + - dependencies + - lint + +download_dependencies: + stage: dependencies + before_script: + - venv .venv + - source .venv/bin/activate + script: + - pip install -r requirements.txt + artifacts: + paths: + - .venv + +pylint: + stage: lint + dependencies: + - download_dependencies + needs: + - download_dependencies + before_script: + - pip install pylint + script: + - pylint calculator --fail-on=error diff --git a/calculator/operators.py b/calculator/operators.py index a353a0108b7235105d0287dfec68c5d8d7c37910..c5534cf81514b6c49325df3211526004ba9a30f9 100644 --- a/calculator/operators.py +++ b/calculator/operators.py @@ -22,3 +22,11 @@ STANDARD_OPERATORS = { '*': Operator('×', 2, lambda a, b: a * b), '/': Operator('/', 2, lambda a, b: a / b), } + +def test_operator(): + """ + Test the Operator class. + """ + operator = Operator('%', 1, lambda a, b: a % b) + assert repr(operator) == '%' + assert operator(15, 4) == 3