WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@whiskeyriver
Copy link

When instantiating a currency via the Currency(str) method, we're losing the defaults set on the currency subclass.

This will resolve a currency symbol to its class definition and preserve the defaults.

For example, prior to this fix the following code will fail:

rwf = Currency("RWF")
assert rwf.decimal_digits == Currency.RWF.decimal_digits

Resolves #254

When instantiating the Currency class we need to resolve a `str`
currency symbol to its definition class to preserve any attribute
overrides.

Resolves kalaspuff#254
@codecov
Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (1e89e0d) to head (ede88e6).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #316   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         1960      1962    +2     
=========================================
+ Hits          1960      1962    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initialising Currency from ticker string does not set correct decimal_digits

1 participant