Beispiel #1
0
def test_frenchmaps():
    datas = {}
    for dept in DEPARTMENTS.keys():
        datas[dept] = int(''.join([x for x in dept if x.isdigit()])) * 10

    fmap = FrenchMapDepartments()
    fmap.add('departements', datas)
    q = fmap.render_pyquery()
    assert len(
        q('#departements .departement,#dom-com .departement')
    ) == len(DEPARTMENTS)

    fmap = FrenchMapRegions()
    fmap.add('regions', aggregate_regions(datas))
    q = fmap.render_pyquery()
    assert len(q('#regions .region,#dom-com .region')) == len(REGIONS)

    assert aggregate_regions(datas.items()) == aggregate_regions(datas)
Beispiel #2
0
    def test_frenchmapdepartments():
        fmap = FrenchMapDepartments(style=choice(list(styles.values())))
        for i in range(10):
            fmap.add('s%d' % i, [
                (choice(list(DEPARTMENTS.keys())), randint(0, 100))
                for _ in range(randint(1, 5))])

        fmap.add('links', [{
            'value': (69, 10),
            'label': '\o/',
            'xlink': 'http://google.com?q=69'
        }, {
            'value': ('42', 20),
            'label': 'Y',
        }])
        fmap.add('6th', [3, 5, 34, 12])
        fmap.title = 'French map'
        return fmap.render_response()