def test0_panel_ops( me): pa = Panel(a) pa += None pa *= None pa *= 'boza',{} s = Grab_stdout() pa._print() expect = """\ Panel {} 5 columns + + 5: input-Checkbox: "log.enabled", size 15 23: input-Chooser: "dir.change_root", size 19 48: outside: "other one", size 9 66: outside: "bozoa", size 5 72: empty: "pipo", flags @, size 7 + 4: input-Text: "log.name", size 13x3 23: input-Text: "log.size", size 12 48: label: "dir.change_response.label", size 29 + 23: button: "trace.show", size 13 48: input-Chooser: "dir.change_response", size 23x3 + 6: outside: "some text", size 9 23: button: "log.show", size 11 + None 0: outside: "boza", size 4 """ s.release() result = str(s) #print result print result if result != expect: df = '\n'.join( diff( result, expect, 'result', 'expect') ) me.failUnless( result == expect, 'result != expect\n'+df)
def compare( me, mode='panelsz'): s = Grab_stdout() panel_term._print( mode=mode) p = str(s) s.release() s.grab() panel_term.walk( Panel.Printer( mode=mode )) q = str(s) s.release() if p != q: print q df = '\n'.join( diff( p,q, '_print recursive', 'Printer visitor')) me.failUnless( p == q, '_print != visitor\n'+df)