def test_calculate_tags(monkeypatch):
    monkeypatch.setattr(matcher, 'current_app', MockApp)

    test_entity = {
        'claims': {
            'P31': [{
                'mainsnak': {
                    'datatype': 'wikibase-item',
                    'datavalue': {
                        'type': 'wikibase-entityid',
                        'value': {
                            'entity-type': 'item',
                            'id': 'Q15243209',
                            'numeric-id': 15243209
                        }
                    },
                },
            }],
        },
        'labels': {
            'en': {
                'language': 'en',
                'value': 'City Hall Historic District'
            },
        },
        'sitelinks': {},
    }
    tags = {
        'historic', 'boundary=protected_area', 'landuse=residential',
        'boundary=administrative', 'place', 'protect_class=22', 'admin_level'
    }
    item = Item(entity=test_entity, tags=tags)
    result = item.calculate_tags()
    assert 'building' not in result
    assert result == tags | {'leisure=park'}
Exemple #2
0
def test_settlement_not_building():
    test_entity = {
        'claims': {},
        'labels': {'en': {'language': 'en', 'value': 'Capistrano Beach'}},
        'sitelinks': {},
    }

    tags = ['place=neighbourhood', 'landuse=residential']
    item = Item(entity=test_entity, tags=tags)

    assert item.calculate_tags() == set(tags)