Exemplo n.º 1
0
def run():
    ext = boost.python.import_ext("boost_adaptbx_python_streambuf_test_ext")
    ext.call_with_stderr_stdout_do_nothing(ostream(sys.stderr),
                                           ostream(sys.stdout))
    gc.collect()
    ext.call_with_stderr_stdout_do_nothing(
        ostream(without_tell(sys.stderr)),  # bug trigger on MacOS X
        ostream(sys.stdout))
    gc.collect()
    print("OK")
Exemplo n.º 2
0
def run():
  ext = boost.python.import_ext("boost_adaptbx_python_streambuf_test_ext")
  ext.call_with_stderr_stdout_do_nothing(
    ostream(sys.stderr),
    ostream(sys.stdout))
  gc.collect()
  ext.call_with_stderr_stdout_do_nothing(
    ostream(without_tell(sys.stderr)), # bug trigger on MacOS X
    ostream(sys.stdout))
  gc.collect()
  print "OK"
 def exercise_write_failure(self):
   self.create_file_object(mode='r')
   try:
     ext.test_write(ostream(self.file_object), "write")
   except ValueError, err:
     # That Python file object has no 'write' attribute
     assert str(err).find("write") > -1
Exemplo n.º 4
0
 def exercise_write_failure(self):
     self.create_file_object(mode='r')
     try:
         ext.test_write(ostream(self.file_object), "write")
     except ValueError, err:
         # That Python file object has no 'write' attribute
         assert str(err).find("write") > -1
 def exercise_write_and_seek(self):
   self.create_instrumented_file_object(mode='w')
   report = ext.test_write(ostream(self.file_object), "write and seek (cur)")
   assert report == ''
   expected = '1000 times 1000 equals 1000000'
   assert self.file_content() == expected
   assert self.file_object.tell() == 9
   if streambuf.default_buffer_size >= 30:
     assert self.file_object.write_call_log == [ expected ]
   self.file_object.close()
Exemplo n.º 6
0
 def exercise_write_and_seek(self):
     self.create_instrumented_file_object(mode='w')
     report = ext.test_write(ostream(self.file_object),
                             "write and seek (cur)")
     assert report == ''
     expected = '1000 times 1000 equals 1000000'
     assert self.file_content() == expected
     assert self.file_object.tell() == 9
     if streambuf.default_buffer_size >= 30:
         assert self.file_object.write_call_log == [expected]
     self.file_object.close()
Exemplo n.º 7
0
 def exercise_write_failure(self):
     self.create_file_object(mode='r')
     try:
         ext.test_write(ostream(self.file_object), "write")
     except ValueError as err:
         # That Python file object has no 'write' attribute
         assert str(err).find("write") > -1
     except RuntimeError as err:
         # Redhat 8.0: basic_ios::clear(iostate) caused exception
         assert str(err).find("clear") > -1
     else:
         raise Exception_expected
Exemplo n.º 8
0
 def exercise_write(self):
     self.create_file_object(mode='w')
     report = ext.test_write(ostream(self.file_object), "write")
     assert report == ''
     assert self.file_content() == "2 times 1.6 equals 3.2"
     self.file_object.close()
 def exercise_write(self):
   self.create_file_object(mode='w')
   report = ext.test_write(ostream(self.file_object), "write")
   assert report == ''
   assert self.file_content() == "2 times 1.6 equals 3.2"
   self.file_object.close()
Exemplo n.º 10
0
def write_to_stdout():
  ext.test_write(ostream(sys.stdout), "write")