Giter VIP home page Giter VIP logo

pyroman's Introduction

pyroman

Pyroman is a Roman numeral conversion library written for Python 3.6. Provided are the main library, unit tests, and a command line wrapper for the library. It can convert any integer number between 1 and 4,999 to a Roman numeral, or the same in reverse. Featuring dynamically generated lookup tables for a very fast execution.

The idea and source code for this project originally came from Dive Into Python 3 by Mark Pilgrim.

Basic Usage

Library

Command Line Wrapper

Gtk3 Wrapper

I have created a simple to use Gtk3 wrapper for use of the library without entering a Python shell or writing a script. Make sure roman_gui.py has execute permissions and run the executable directly.

The output mode setting controls the type of input accepted and the type returned. Numeral mode accepts an integer and returns a Roman numeral. Integer mode accepts a Roman numeral and returns an integer. Note that Roman numeral input must be uppercase. Integer input must be whole numbers, greater than 0 but less than 4,999.

TODO

Library
Command Line Wrapper
Gtk3 Wrapper
  • Error checking for input
  • Exception handling and error output
  • Basic program description in the main window
  • Visual tweaks and enhancements

Unit Tests

Current unit test results: Pass

-> % python roman_test.py -v
test_blank (__main__.FromRomanBadInput)
from_roman should fail with blank string ... ok
test_malformed_antecedents (__main__.FromRomanBadInput)
from_roman should fail with malformed antecedents ... ok
test_repeated_pairs (__main__.FromRomanBadInput)
from_roman should fail with repeated pairs of numerals ... ok
test_too_many_repeated_numerals (__main__.FromRomanBadInput)
from_roman should fail with too many repeated numerals ... ok
test_roundtrip (__main__.RoundTripCheck)
from_roman(to_roman(n)) == n for all n ... ok
test_negative (__main__.ToRomanBadInput)
to_roman should fail with negative input ... ok
test_non_integer (__main__.ToRomanBadInput)
to_roman should fail with non-integer input ... ok
test_too_large (__main__.ToRomanBadInput)
to_roman should fail with large input ... ok
test_zero (__main__.ToRomanBadInput)
to_roman should fail with 0 input ... ok
test_from_roman_known_values (__main__.ToRomanGoodInput)
from_roman should give known result with known input ... ok
test_to_roman_known_values (__main__.ToRomanGoodInput)
to_roman should give known result with known input ... ok

----------------------------------------------------------------------
Ran 11 tests in 0.011s

OK

pyroman's People

Contributors

ncdulo avatar

Watchers

 avatar

pyroman's Issues

Need setup.py

A setup.py file is needed for user installation or PyPi release. This file looks relatively simple to create. May require some refactoring of project structure, or inclusion of some new files into the repository to properly finish this without needing to refactor later.

Document classes, methods and members

A basic level of documentation already exists within PyRoman. The documentation could be a bit more verbose, and include more methods and members than it already does. Documentation requested is in the form of docstrings and comments that may be easily parsed by automated tools such as Sphinx.

Areas in need of attention, not an all-inclusive list, doc your heart out!

  • Exceptions
  • Internal and external facing methods
  • Class members
  • Wrappers for TUI/GUI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.