mapbox/mercantile

Test failures with Python 2.7

Closed this issue · 1 comments

Changes in #101 have broken the tests with Python 2.7.

============================= test session starts ==============================
platform linux2 -- Python 2.7.15+, pytest-4.6.5, py-1.8.0, pluggy-0.13.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/sean/projects/mercantile/.hypothesis/examples')
rootdir: /home/sean/projects/mercantile
plugins: hypothesis-4.36.0, cov-2.7.1
collected 104 items

tests/test_cli.py ...............FF......................                [ 37%]
tests/test_funcs.py ...................FF............................... [ 87%]
.............                                                            [100%]

=================================== FAILURES ===================================
____________________________ test_cli_bounding_tile ____________________________

    def test_cli_bounding_tile():
        runner = CliRunner()
        result = runner.invoke(cli, ["bounding-tile"], "[-105, 39.99, -104.99, 40]")
        assert result.exit_code == 0
>       assert result.output == "[1706, 3101, 13]\n"
E       AssertionError: assert '[0, 1, 2]\n' == '[1706, 3101, 13]\n'
E         - [0, 1, 2]
E         + [1706, 3101, 13]

tests/test_cli.py:163: AssertionError
_________________________ test_cli_bounding_tile_bbox __________________________

    def test_cli_bounding_tile_bbox():
        runner = CliRunner()
        result = runner.invoke(
            cli, ["bounding-tile"], '{"bbox": [-105, 39.99, -104.99, 40]}'
        )
        assert result.exit_code == 0
>       assert result.output == "[1706, 3101, 13]\n"
E       AssertionError: assert '[0, 1, 2]\n' == '[1706, 3101, 13]\n'
E         - [0, 1, 2]
E         + [1706, 3101, 13]

tests/test_cli.py:172: AssertionError
__________________________________ test_tiles __________________________________

    def test_tiles():
        bounds = (-105, 39.99, -104.99, 40)
        tiles = list(mercantile.tiles(*bounds, zooms=[14]))
        expect = [
            mercantile.Tile(x=3413, y=6202, z=14),
            mercantile.Tile(x=3413, y=6203, z=14),
        ]
>       assert sorted(tiles) == sorted(expect)
E       assert [Tile(x=0, y=...3, z=14), ...] == [Tile(x=3413, ...y=6203, z=14)]
E         At index 0 diff: Tile(x=0, y=6202, z=14) != Tile(x=3413, y=6202, z=14)
E         Left contains 6826 more items, first extra item: Tile(x=1, y=6202, z=14)
E         Use -v to get the full diff

tests/test_funcs.py:122: AssertionError
____________________________ test_tiles_single_zoom ____________________________

    def test_tiles_single_zoom():
        bounds = (-105, 39.99, -104.99, 40)
        tiles = list(mercantile.tiles(*bounds, zooms=14))
        expect = [
            mercantile.Tile(x=3413, y=6202, z=14),
            mercantile.Tile(x=3413, y=6203, z=14),
        ]
>       assert sorted(tiles) == sorted(expect)
E       assert [Tile(x=0, y=...3, z=14), ...] == [Tile(x=3413, ...y=6203, z=14)]
E         At index 0 diff: Tile(x=0, y=6202, z=14) != Tile(x=3413, y=6202, z=14)
E         Left contains 6826 more items, first extra item: Tile(x=1, y=6202, z=14)
E         Use -v to get the full diff

tests/test_funcs.py:132: AssertionError
=============================== warnings summary ===============================
mercantile/__init__.py:11
  /home/sean/projects/mercantile/mercantile/__init__.py:11: DeprecationWarning: Python versions < 3 will not be supported by mercantile 2.0.
    DeprecationWarning,

-- Docs: https://docs.pytest.org/en/latest/warnings.html

---------- coverage: platform linux2, python 2.7.15-final-0 ----------
Name                             Stmts   Miss  Cover   Missing
--------------------------------------------------------------
mercantile/__init__.py             276      1    99%   15
mercantile/scripts/__init__.py     229      0   100%
--------------------------------------------------------------
TOTAL                              505      1    99%

=============== 4 failed, 100 passed, 1 warnings in 0.56 seconds ===============

Resolved by 478e7e1.