Skip to content

BogdanKandra/roman-numerals

Repository files navigation

roman-numerals

Roman numerals convertor, a small project illustrating advanced Python concepts


Features / concepts explored

  • User-defined class with constructors, static methods and many overriden magic methods
    • Users are able to do type conversion, string representation, arithmetic and comparison operations, using Roman numerals and other numeric types
  • Custom made coroutines
  • Custom made decorator
  • Custom made enum
  • Custom made exceptions
  • Custom made generators
  • Implementation of the Iterator Protocol
  • Jupyter Notebook which illustrates usage of all Roman class functionality
  • Unit tests for all functionality in the project
  • Separate requirements.txt and test-requirements.txt files, holding the development and testing dependencies

Steps for running

  • Create a virtual environment for the project: conda create -n <env_name> python=3.10
  • Activate the virtual environment: conda activate <env_name>
  • Install the development dependencies: pip install -r requirements.txt
  • Start Python interpreter, import the Roman class and play with Roman numbers!
    • Test by first importing the Roman class: from scripts.roman import Roman

Steps for testing

  • Create a virtual environment for the project (or activate the one created for the step above)
  • Install the testing dependencies: pip install -r test-requirements.txt
  • Run the pytest test suit from the project base directory: python -m pytest tests
    • Compute the test coverage: coverage run --source=scripts -m pytest -v .\tests\
    • Visualize the test coverage report (in the CLI): coverage report -m
    • Visualize the test coverage report (in the web browser): coverage html -> Then open the index.html file from the newly generated htmlcov directory
  • Run the flake8 linting tool from the project base directory: flake8
  • Run the mypy static type checker from the project base directory: mypy