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

Shapereader doctest failure #1171

Closed
dopplershift opened this issue Nov 6, 2018 · 2 comments
Closed

Shapereader doctest failure #1171

dopplershift opened this issue Nov 6, 2018 · 2 comments
Milestone

Comments

@dopplershift
Copy link
Contributor

Currently seeing this on Travis on the latest py2k build:

024     >>> filename = shapereader.natural_earth(resolution='110m'
025     ...                                      category='physical'
026     ...                                      name='geography_regions_points')
027     >>> reader = shapereader.Reader(filename)
028     >>> len(reader)
029     3
030     >>> records = list(reader.records())
031     >>> print(type(records[0]))
032     <class 'cartopy.io.shapereader.Record'>
033     >>> print(sorted(records[0].attributes.keys()))
Expected:
    ['comment', ... 'name', 'name_alt', ... 'region', ...]
Got:
    [u'comment', u'featurecla', u'label', u'lat_y', u'long_x', u'min_zoom', u'name', u'name_alt', u'name_ar', u'name_bn', u'name_de', u'name_el', u'name_en', u'name_es', u'name_fr', u'name_hi', u'name_hu', u'name_id', u'name_it', u'name_ja', u'name_ko', u'name_nl', u'name_pl', u'name_pt', u'name_ru', u'name_sv', u'name_tr', u'name_vi', u'name_zh', u'ne_id', u'region', u'scalerank', u'subregion', u'wdid_score', u'wikidataid']

So it looks like the problem is the leading u...but does anyone know if this is new behavior from a library (and who) or if it's a problem with the doctest runner?

@dopplershift dopplershift added this to the 0.17 milestone Nov 6, 2018
@QuLogic
Copy link
Member

QuLogic commented Nov 6, 2018

It looks like it's using pyshp 2.0.0, and the first lines of its changes is:

  • Full support for unicode text, with custom encoding, and exception handling.
  • Means that the Reader returns unicode, and the Writer accepts unicode.

@pelson
Copy link
Member

pelson commented Nov 12, 2018

FWIW: Long term, I'd like to move away from the shapereader implementation altogether - Fiona and geopandas have both arrived since that code was written, and they do a better job of documenting and performance.

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

No branches or pull requests

3 participants