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

Issue with formatting coordinates with colons #2183 #2197

Merged
merged 10 commits into from
Mar 18, 2014

Conversation

QuanTakeuchi
Copy link
Contributor

Fixed the ugly appearance of colon when fields is specified to 2

elif len(sep) == 1 and fields == 2:
sep = sep + ('','')
elif len(sep) == 1 and fields == 1:
sep = ('','','')
Copy link
Member

Choose a reason for hiding this comment

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

Just a really silly nitpick about putting spaces after commas, but other than that this looks good to me. I'll wait to let others more familiar with this code comment though.

@QuanTakeuchi
Copy link
Contributor Author

@embray Hi, I am new to open source development and changing others code. This was the best I could think of to make it work without having to change a lot of code. But I hope this solves the issue.

@astrofrog
Copy link
Member

@QuanTakeuchi - this looks good! As @embray pointed out, could you make sure you include spaces after the commas? That is, ('', '', '') instead of ('','','')? Just a matter of style conventions we follow (PEP8)

Added spaces after comma
@QuanTakeuchi
Copy link
Contributor Author

Done including the spaces.

@astrofrog
Copy link
Member

@QuanTakeuchi - could you add the tests to test_angles.py instead of having a separate file? Also, you will need to remove the u unicode prefix from the test values otherwise it won't work on Python 3.1 and 3.2.

One last request - can you add an entry in the CHANGES.rst file, under the coordinates section in 0.3.2? You can look at the rest of the CHANGES.rst file to get an idea for what to write.

@QuanTakeuchi
Copy link
Contributor Author

@astrofrog - made the changes you mentioned. Is the entry made by me in CHANGES.rst fine?

Also wouldn't it be better if I include the test in the file test_formatting.py, as it contains similar tests? I did include it in test_angles.py though.

@astrofrog
Copy link
Member

@QuanTakeuchi - ah yes, I guess test_formatting.py would make more sense - good catch! The CHANGES.rst entry looks good.

@eteq - could you review this too?

@astrofrog astrofrog added this to the v0.3.2 milestone Mar 15, 2014
@astrofrog astrofrog added the Bug label Mar 15, 2014
@eteq
Copy link
Member

eteq commented Mar 18, 2014

looks fine to me, except that the most recent tests are still failing. I think this is a transient error, so I restarted the tests. Assuming they pass it looks good.

@@ -529,8 +529,12 @@ def sexagesimal_to_string(values, precision=None, pad=False, sep=(':',),

if not sep: # empty string, False, or None, etc.
sep = ('', '', '')
elif len(sep) == 1:
elif len(sep) == 1 and fields == 3:
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for a late and somewhat nitpicky comment, but a nested if statement would seem more logical (and faster):

elif len(sep) == 1:
    if fields == 1:
        ...
    elif fields == 2:
        ...
    else:
        ...

and then also move the check that 1 <= fields <= 3 so that we know that fields is correct here.

@QuanTakeuchi
Copy link
Contributor Author

@mhvk Did the changes you mentioned. I hope that's what you meant by moving the check.

mhvk added a commit that referenced this pull request Mar 18, 2014
Issue with formatting coordinates with colons #2183
@mhvk mhvk merged commit ed1f5ad into astropy:master Mar 18, 2014
@mhvk
Copy link
Contributor

mhvk commented Mar 18, 2014

@QuanTakeuchi - yes, this was exactly what I meant. Since travis is happy, I'll merge...

@mhvk
Copy link
Contributor

mhvk commented Mar 18, 2014

p.s. Thanks!

QuanTakeuchi pushed a commit to QuanTakeuchi/astropy that referenced this pull request Mar 23, 2014
I think astropy#2112 changes this from ``pytest-cov`` to ``coverage``

Don't generate .pyc files when running tests

Ensure name-less columns can be printed, plus test case and bug-fix note.

str -> six.text_type, move change to 0.3.2 bug-fix section

Update development_workflow.rst

typo fix

Merge pull request astropy#2197 from QuanTakeuchi/master

Issue with formatting coordinates with colons astropy#2183

WCS accepts coordinates objects

modified WCS accepts coordinate objects

minor spaces removal
mhvk added a commit that referenced this pull request Mar 27, 2014
Issue with formatting coordinates with colons #2183
Conflicts:

	astropy/coordinates/tests/test_formatting.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants