def test_numpy(): # Test to see whether numpy arrays work correctly # Must have numpy installed to do this test correctly data = [10, 20, 30, 40, 50, 60, 70, 80, 90] try: from numpy import array data = array(data) except ImportError: _print('Warning: numpy must be installed to do this test correctly') chart = Radar(data, encoding='text') chart.size(200, 200) return chart
def test_numpy(): # Test to see whether numpy arrays work correctly # Must have numpy installed to do this test correctly data = [10,20,30,40,50,60,70,80,90] try: from numpy import array data = array(data) except ImportError: _print('Warning: numpy must be installed to do this test correctly') chart = Radar(data, encoding='text') chart.size(200,200) return chart
def test_extended_encode(): _test_encoding('extended', 'e:AH-HAA..', [7, 3975, 0, 4095], 4095) if __name__ == '__main__': def get_chart(chart): return getattr(TestChartTypes('test_%s' % chart), 'test_%s' % chart)() def saveall(): import os if not os.path.isdir('tests'): os.mkdir('tests') for chart in TestChartTypes.all: chartobj = get_chart(chart) chartobj.save('tests/%s' % chart) import sys calls = { 'unit': lambda: unittest.main(), 'save': lambda: saveall(), } arg = sys.argv[-1] sys.argv = sys.argv[:-1] if arg in calls: calls[arg]() else: for chart in TestChartTypes.all: _print(chart, '\t', get_chart(chart))
_test_encoding('text', 't:0.0,10.0,100.0,-1.0,-1.0', [0,10,100,-1,-1], (0,100)) def test_extended_encode(): _test_encoding('extended', 'e:AH-HAA..', [7,3975,0,4095], 4095) if __name__ == '__main__': def get_chart(chart): return getattr(TestChartTypes('test_%s'%chart), 'test_%s'%chart)() def saveall(): import os if not os.path.isdir('tests'): os.mkdir('tests') for chart in TestChartTypes.all: chartobj = get_chart(chart) chartobj.save('tests/%s'%chart) import sys calls = { 'unit': lambda: unittest.main(), 'save': lambda: saveall(), } arg = sys.argv[-1] sys.argv = sys.argv[:-1] if arg in calls: calls[arg]() else: for chart in TestChartTypes.all: _print( chart,'\t',get_chart(chart))