Exemple #1
0
 def testEnumTpPrintImplementation(self):
     '''Without SbkEnum.tp_print 'print' returns the enum represented as an int.'''
     tmpfile = createTempFile()
     if IS_PY3K:
         from py3k import printToFile
         printToFile(tmpfile, Event.ANY_EVENT)
     else:
         sys.stdout = tmpfile
         print(Event.ANY_EVENT)
         sys.stdout = sys.__stdout__
     tmpfile.seek(0)
     text = tmpfile.read().strip()
     tmpfile.close()
     self.assertEqual(text, str(Event.ANY_EVENT))
     self.assertEqual(text, repr(Event.ANY_EVENT))
Exemple #2
0
 def testEnumTpPrintImplementation(self):
     '''Without SbkEnum.tp_print 'print' returns the enum represented as an int.'''
     tmpfile = createTempFile()
     if IS_PY3K:
         from py3k import printToFile
         printToFile(tmpfile, Event.ANY_EVENT)
     else:
         sys.stdout = tmpfile
         print(Event.ANY_EVENT)
         sys.stdout = sys.__stdout__
     tmpfile.seek(0)
     text = tmpfile.read().strip()
     tmpfile.close()
     self.assertEqual(text, str(Event.ANY_EVENT))
     self.assertEqual(text, repr(Event.ANY_EVENT))