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

Fix the loading of the currency format types #203

Merged
merged 3 commits into from
Sep 27, 2015
Merged

Fix the loading of the currency format types #203

merged 3 commits into from
Sep 27, 2015

Conversation

etanol
Copy link
Contributor

@etanol etanol commented Aug 16, 2015

In order to fix #201, it was necessary to properly interpret the type attribute of the currencyFormat elements in CLDR data. It apparently changed between version 23 and 26.

@codecov-io
Copy link

Current coverage is 83.11%

Merging #203 into master will increase coverage by +0.04% as of 14f241c

@@            master    #203   diff @@
======================================
  Files           21      21       
  Stmts         3780    3784     +4
  Branches         0       0       
  Methods          0       0       
======================================
+ Hit           3140    3145     +5
  Partial          0       0       
+ Missed         640     639     -1

Review entire Coverage Diff as of 14f241c

Powered by Codecov. Updated on successful CI builds.

@etanol
Copy link
Contributor Author

etanol commented Aug 16, 2015

The decrease in overall coverage is due to a change in a doctest. Maybe codecov is not running them?

@sils
Copy link
Member

sils commented Aug 16, 2015

@etanol tests are run by travis using pytest, if doctests aren't run that's a bug but IIRC they are run.

@etanol
Copy link
Contributor Author

etanol commented Aug 16, 2015

@sils1297 Then, how can I avoid this coverage decrease?

@sils
Copy link
Member

sils commented Aug 16, 2015

@etanol you should be able to reproduce the coverage report with make test-cov after pip install pytest-cov. Either doctests aren't executed, should be easy to test locally, or your tests are insufficient. In the first case, please file a bug and refer to it but IIRC pytest should do that.

@etanol
Copy link
Contributor Author

etanol commented Aug 18, 2015

There seems to be a problem with the process environment on Windows for Python 2.7. The function babel.core.default_locale returns None when there is no system locale information available from the environment variables (LANGUAGE, LANG, LC_*).

I'm going to change the doctest so this doesn't fail. However, maybe some review needs to be performed on the AppVeyor configuration, since all Python 3 setups appear to work fine.

== u'$1,099.98')


def test_format_currency_format_type():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of using multiple assertions like that in a single test case, I would write 3 test cases:

  • test_format_current_with_standard_format_type
  • test_format_current_with_accounting_format_type
  • test_format_current_with_invalid_format_type

Just personal taste (this is not a blocker to approve this PR. 😄 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duly noted. I'll keep this in mind for future PRs.

@erickwilder
Copy link
Contributor

@sils1297 this looks good to me.

@erickwilder
Copy link
Contributor

@etanol
Can you add an entry to the CHANGES file, under the upcoming 3.x version just to keep track of changes you've made?

We don't have any formal guideline regarding this, but I think asking PR authors to do this it's the easiest way to keep our change log updated. Thank's

@etanol
Copy link
Contributor Author

etanol commented Aug 28, 2015

@erickwilder Done. I took the chance to include information related to my other PR #180. I hope is not an issue.

@sils
Copy link
Member

sils commented Sep 7, 2015

@etanol it seems we are still not capable of maintaining this repository without larger delays for basically everything and you're more of a Babel dev than I am tbh. You do seem to have some kind of interest in Babel, would you be interested in help us reviewing and triaging bugs a bit?

@etanol
Copy link
Contributor Author

etanol commented Sep 7, 2015

@sils1297 Sure, I'll be glad to help. Although my availability is variable, I always try to dedicate a couple of hours a week to free coding.

@sils
Copy link
Member

sils commented Sep 7, 2015

@etanol cool, nobody is full time availabe for this one anyway. Whenever your passion takes over feel free to review some "pending review" PRs. I'll try to get you permissions to relabel stuff, we still need @mitsuhiko to do that kind of stuff and it's usually hard to grab him.

@erickwilder
Copy link
Contributor

Hi @etanol
Other pull requests were approved and it seems to have caused some conflicts here. Can you rebase this so I can merge it to our master branch?

Sorry for the delay. My daughter was born a couple days ago and I was out of the radar for a while.
Thanks

@sils
Copy link
Member

sils commented Sep 21, 2015

@etanol marking this one in-progress as it seems to need a rebase and coverage still complains.

@codecov-io
Copy link

Current coverage is 83.44%

Merging #203 into master will increase coverage by +0.04% as of 1a01af8

@@            master    #203   diff @@
======================================
  Files           21      21       
  Stmts         3790    3794     +4
  Branches         0       0       
  Methods          0       0       
======================================
+ Hit           3161    3166     +5
  Partial          0       0       
+ Missed         629     628     -1

Review entire Coverage Diff as of 1a01af8

Powered by Codecov. Updated on successful CI builds.

@sils
Copy link
Member

sils commented Sep 26, 2015

@etanol are there any notable changes from the state where @erickwilder approved this? Does it need another full review?

@etanol
Copy link
Contributor Author

etanol commented Sep 26, 2015

@sils1297 I need to fix the CHANGES file, give me a day or two please.

@sils
Copy link
Member

sils commented Sep 26, 2015

You may want to merge my PR that sets the version numbers in CHANGES right
in the meantime.
On Sep 26, 2015 8:28 PM, "Isaac Jurado" [email protected] wrote:

@sils1297 https://github.com/sils1297 I need to fix the CHANGES file,
give me a day or two please.


Reply to this email directly or view it on GitHub
#203 (comment).

@sils sils added this to the Babel 2.2 milestone Sep 27, 2015
@sils sils assigned etanol and unassigned erickwilder Sep 27, 2015
@sils
Copy link
Member

sils commented Sep 27, 2015

And well, this needs of course a rebase because of the damn conflicts file :)

etanol and others added 3 commits September 27, 2015 15:05
The type of the currency format (e.g. "standard", "accounting") was not
interpreted correctly from the CLDR data.  Now there should not be any currency
format identified by "None".

Fixes #201
Previous commit introduced an API change by changing the behaviour of
the format param, instead this commit adds a format_type param and the
documentation and tests to accompany it.

Note that currency_formats returns a NumberPattern already, so there is
no need to call parse_pattern on the value returned.
sils added a commit that referenced this pull request Sep 27, 2015
Fix the loading of the currency format types
@sils sils merged commit a82d7b0 into python-babel:master Sep 27, 2015
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.

format_currency only ever retrieves the default locale currency format
5 participants