File: test_config.py

package info (click to toggle)
python-geopandas 0.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,004 kB
  • sloc: python: 14,226; makefile: 150; sh: 14
file content (29 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import geopandas

import pytest


def test_options():
    assert "display_precision: " in repr(geopandas.options)

    assert dir(geopandas.options) == ["display_precision", "use_pygeos"]

    with pytest.raises(AttributeError):
        geopandas.options.non_existing_option

    with pytest.raises(AttributeError):
        geopandas.options.non_existing_option = 10


def test_options_display_precision():
    assert geopandas.options.display_precision is None
    geopandas.options.display_precision = 5
    assert geopandas.options.display_precision == 5

    with pytest.raises(ValueError):
        geopandas.options.display_precision = "abc"

    with pytest.raises(ValueError):
        geopandas.options.display_precision = -1

    geopandas.options.display_precision = None