File: test_id_filter.py

package info (click to toggle)
pyosmium 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,584 kB
  • sloc: python: 4,400; cpp: 2,504; makefile: 20
file content (30 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (3)
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
30
# SPDX-License-Identifier: BSD-2-Clause
#
# This file is part of pyosmium. (https://osmcode.org/pyosmium/)
#
# Copyright (C) 2025 Sarah Hoffmann <lonvia@denofr.de> and others.
# For a full list of authors see the git log.
import pytest

import osmium
from helpers import IDCollector


def test_id_filter_bad_argument():
    with pytest.raises(TypeError):
        osmium.filter.IdFilter(None)


def test_id_filter_simple(opl_reader):
    data = """\
           n1
           n2
           n4
           n200
           """

    ids = IDCollector()

    osmium.apply(opl_reader(data), osmium.filter.IdFilter([2, 5, 200, 201]), ids)

    assert ids.nodes == [2, 200]