GeospatialPython / pyshp

This library reads and writes ESRI Shapefiles in pure Python.
MIT License
1.09k stars 259 forks source link

Reformat code block as markdown literal code, so doctest skips it. Fixes #264 #265

Closed JamesParrott closed 7 months ago

JamesParrott commented 8 months ago

The code block causing the doctests to fail is a helpful example for users, but the whole point of it is to use a variable name, which is not defined in the snippet.

This PR simply removes the >>>s so doctest skips it.

Alternatively, this variable (filename) could be defined in the code block. But then the text of the readme would need to be rewritten to reflect this.

If it is desirable to keep this test, it could easily be added to the pytest tests in test_shapefile.py, at the cost of duplication.

JamesParrott commented 8 months ago

Local test session:

C:\tmp2>git clone --depth=1 --branch PyShp-fix-doctest https://github.com/JamesParrott/IronPyShp .
Cloning into '.'...
remote: Enumerating objects: 80, done.
remote: Counting objects: 100% (80/80), done.
remote: Compressing objects: 100% (73/73), done.
remote: Total 80 (delta 17), reused 46 (delta 4), pack-reused 0
Receiving objects: 100% (80/80), 2.02 MiB | 486.00 KiB/s, done.
Resolving deltas: 100% (17/17), done.

C:\tmp2>python --version
Python 3.12.1

C:\tmp2>python shapefile.py
Running doctests...
All test passed successfully

C:\tmp2>c:\Python27\python.exe --version
Python 2.7.18

C:\tmp2>c:\Python27\python.exe shapefile.py
Running doctests...
All test passed successfully