Pounds, shillings and pence conversion
Project description
LSD - pounds, shillings and pence
A library for converting between pre-decimal British currency and decimal ('new pence') currency.
Usage
>>> import lsd
>>> from decimal import Decimal
>>> lsd.pounds_shillings_and_pence(Decimal("1.49"))
(1, 9, 10)
>>> lsd.pounds_and_new_pence(19, 19, 6)
Decimal('19.975')
For more usage examples, see the file examples.md
Calculations use the built-in Decimal class for amounts of pounds in new money. Calculation is thus dependent on the constraints of the Decimal class. This does not do arbitrary-precision arithmetic. Thus there are some numbers which are too big to be converted. You can alter these limits by setting the Decimal context in your own code. See [[https://docs.python.org/2/library/decimal.html#context-objects]] or [[https://docs.python.org/3.7/library/decimal.html#context-objects]].
Development
Now using poetry. To run tests do:
poetry run python -m unittest
Thanks
There are only a small number of tests for this project. That's thanks to the awesome hypothesis project which generates test cases for unit tests. It's really powerful for checking edge cases. See [[https://github.com/HypothesisWorks/hypothesis]]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lsd-0.4.0.tar.gz.
File metadata
- Download URL: lsd-0.4.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.13.2 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c01b0b4b421fdd246e3e59056cbf0cc61924c32ee228be6c4f5cd1538a6d2c3b
|
|
| MD5 |
fae45f14f4a68048b5f7f94ff14b7d82
|
|
| BLAKE2b-256 |
540128d7c9d30cb97a1d756967a59c4edf023a807ca75588054be0b24b45a407
|
File details
Details for the file lsd-0.4.0-py3-none-any.whl.
File metadata
- Download URL: lsd-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.0 CPython/3.13.2 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
972bc3eaadb07819ae9677c90e35ef7637677c596a124c1d789ad27cb400cafe
|
|
| MD5 |
521e2fed3662a74f80809afa73056fb2
|
|
| BLAKE2b-256 |
4cd841172c286b232796a616b537ec0765cb83f4c1ebcf886be773a4d2d8b8df
|