コード例 #1
0
 def test_string_display(self):
     capturedOutput = io.StringIO()                  # Create StringIO object
     sys.stdout = capturedOutput                     #  and redirect stdout.
     CS.print_chain_acceptance_info(chain)
     sys.stdout = sys.__stdout__  # Reset redirect.
     self.assertTrue(isinstance(capturedOutput.getvalue(), str),
                     msg='Caputured string')
     self.assertFalse('Results dictionary' in capturedOutput.getvalue(),
                     msg='Expect results dictionary not included')
コード例 #2
0
 def test_string_display_with_results(self):
     capturedOutput = io.StringIO()                  # Create StringIO object
     sys.stdout = capturedOutput                     #  and redirect stdout.
     CS.print_chain_acceptance_info(
             chain, results=dict(
                     nsimu=5000,
                     iacce=np.array([200, 800])
                     ))
     sys.stdout = sys.__stdout__  # Reset redirect.
     self.assertTrue(isinstance(capturedOutput.getvalue(), str),
                     msg='Caputured string')
     self.assertTrue('Results dictionary' in capturedOutput.getvalue(),
                     msg='Expect results dictionary included')