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: loader.from_url(). #4

Merged
merged 1 commit into from
Mar 20, 2016
Merged

fix: loader.from_url(). #4

merged 1 commit into from
Mar 20, 2016

Conversation

micahcochran
Copy link
Contributor

Add unittest testpycrs.py using python framework for loader.from_url(). parser.from_unknown_text() returns output. loader.from_url() in Python 3 urllib decodes bytes.

You can download testpycrs.py or do this in Python 2 or 3.
Here is the test

In [1]: import pycrs

In [2]: crs = pycrs.loader.from_url('http://spatialreference.org/ref/esri/102630/esriwkt/')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-a113c27d1212> in <module>()
----> 1 crs = pycrs.loader.from_url('http://spatialreference.org/ref/esri/102630/esriwkt/')

/home/micah/prj2/PyCRS/pycrs/loader.py in from_url(url, format)
     42 
     43     # then load
---> 44     crs = func(string)
     45     return crs
     46 

/home/micah/prj2/PyCRS/pycrs/parser.py in from_unknown_text(text, strict)
    739     """
    740 
--> 741     if string.startswith("+"):
    742         from_proj4(string, strict)
    743 

NameError: global name 'string' is not defined

This patch fixes this function.

…ork for loader.from_url(). parser.from_unknown_text() returns output. loader.from_url() in Python 3 urllib decodes bytes.
karimbahgat added a commit that referenced this pull request Mar 20, 2016
@karimbahgat karimbahgat merged commit 339cfb1 into karimbahgat:master Mar 20, 2016
@karimbahgat
Copy link
Owner

This is great, thanks!

@micahcochran micahcochran deleted the fix_from_url branch March 21, 2016 16:31
@micahcochran
Copy link
Contributor Author

Thank you.

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.

2 participants