def test_frenchmapregions(): fmap = FrenchMap_Regions(style=choice(list(styles.values()))) for i in range(10): fmap.add('s%d' % i, [(choice(list(REGIONS.keys())), randint(0, 100)) for _ in range(randint(1, 5))]) fmap.add('links', [{ 'value': ('02', 10), 'label': '\o/', 'xlink': 'http://google.com?q=69' }, { 'value': ('72', 20), 'label': 'Y', }]) fmap.add('6th', [91, 2, 41]) fmap.title = 'French map' return fmap.render_response()
def test_frenchmapregions(): fmap = FrenchMap_Regions(style=choice(list(styles.values()))) for i in range(10): fmap.add("s%d" % i, [(choice(list(REGIONS.keys())), randint(0, 100)) for _ in range(randint(1, 5))]) fmap.add( "links", [ {"value": ("02", 10), "label": "\o/", "xlink": "http://google.com?q=69"}, {"value": ("72", 20), "label": "Y"}, ], ) fmap.add("6th", [91, 2, 41]) fmap.title = "French map" return fmap.render_response()
def test_frenchmapregions(): fmap = FrenchMap_Regions(style=choice(list(styles.values()))) for i in range(10): fmap.add('s%d' % i, [ (choice(list(REGIONS.keys())), randint(0, 100)) for _ in range(randint(1, 5))]) fmap.add('links', [{ 'value': ('02', 10), 'label': '\o/', 'xlink': 'http://google.com?q=69' }, { 'value': ('72', 20), 'label': 'Y', }]) fmap.add('6th', [91, 2, 41]) fmap.title = 'French map' return fmap.render_response()
def test_frenchmaps(): datas = {} for dept in DEPARTMENTS.keys(): datas[dept] = int(''.join([x for x in dept if x.isdigit()])) * 10 fmap = FrenchMap_Departments() fmap.add('departements', datas) q = fmap.render_pyquery() assert len( q('#departements .departement,#dom-com .departement') ) == len(DEPARTMENTS) fmap = FrenchMap_Regions() 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)