def test_formatters(Chart):
 if (Chart._dual or (Chart == Box)):
  return
 chart = Chart(formatter=(lambda x, chart, serie: ('%s%s$' % (x, serie.title))))
 chart.add('_a', [1, 2, {'value': 3, 'formatter': (lambda x: (u('%s\xc2\xa5') % x))}])
 chart.add('_b', [4, 5, 6], formatter=(lambda x: (u('%s\xe2\x82\xac') % x)))
 chart.x_labels = [2, 4, 6]
 chart.x_labels_major = [4]
 q = chart.render_pyquery()
 assert (set([v.text for v in q('.value')]) == set(((u('4\xe2\x82\xac'), u('5\xe2\x82\xac'), u('6\xe2\x82\xac'), '1_a$', '2_a$', u('3\xc2\xa5')) + (('6_a$', u('15\xe2\x82\xac')) if (Chart in (Pie, SolidGauge)) else ()))))

def test_formatters ( Chart ) : if ( Chart . _dual or ( Chart == Box ) ) : return chart = Chart ( formatter = ( lambda x , chart , serie : ( '%s%s$' % ( x , serie . title ) ) ) ) chart . add ( '_a' , [ 1 , 2 , { 'value' : 3 , 'formatter' : ( lambda x : ( u ( '%s\xc2\xa5' ) % x ) ) } ] ) chart . add ( '_b' , [ 4 , 5 , 6 ] , formatter = ( lambda x : ( u ( '%s\xe2\x82\xac' ) % x ) ) ) chart . x_labels = [ 2 , 4 , 6 ] chart . x_labels_major = [ 4 ] q = chart . render_pyquery ( ) assert ( set ( [ v . text for v in q ( '.value' ) ] ) == set ( ( ( u ( '4\xe2\x82\xac' ) , u ( '5\xe2\x82\xac' ) , u ( '6\xe2\x82\xac' ) , '1_a$' , '2_a$' , u ( '3\xc2\xa5' ) ) + ( ( '6_a$' , u ( '15\xe2\x82\xac' ) ) if ( Chart in ( Pie , SolidGauge ) ) else ( ) ) ) ) )
test custom formatters .