Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to the library to make the Money, Rate and Number objects copyable with copy.copy / copy.deepcopy #243

Merged
merged 6 commits into from
Aug 15, 2023

Conversation

kalaspuff
Copy link
Owner

>>> from stockholm import Money, Number
>>> import copy
>>> 
>>> lst = [Money(4711, "SEK"), Money(0.01, "SEK"), Number(42)]
>>> 
>>> copy.copy(lst)
[<stockholm.Money: "4711.00 SEK">, <stockholm.Money: "0.01 SEK">, <stockholm.Number: "42">]
>>> copy.deepcopy(lst)
[<stockholm.Money: "4711.00 SEK">, <stockholm.Money: "0.01 SEK">, <stockholm.Number: "42">]
>>> from stockholm import Money, Number
>>> import copy
>>> 
>>> d = {"values": [Number(1338.9999999), Money("499.99 USD")]}
>>> 
>>> copy.copy(d)
{'values': [<stockholm.Number: "1338.999999999">, <stockholm.Money: "499.99 USD">]}
>>> copy.deepcopy(d)
{'values': [<stockholm.Number: "1338.999999999">, <stockholm.Money: "499.99 USD">]}

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #243 (47f3c23) into master (283ebc7) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #243   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         1818      1810    -8     
=========================================
- Hits          1818      1810    -8     
Files Changed Coverage Δ
stockholm/money.py 100.00% <100.00%> (ø)
stockholm/rate.py 100.00% <100.00%> (ø)

@kalaspuff kalaspuff linked an issue Aug 15, 2023 that may be closed by this pull request
@kalaspuff kalaspuff merged commit 8533780 into master Aug 15, 2023
14 checks passed
@kalaspuff kalaspuff deleted the feature/copy-object branch August 15, 2023 17:33
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.

Stockholm money objects does not support deepcopying
1 participant