def testWrongGluNumAtoms(self):
     test_input = ["-f", GLU_FILE, "-n", NOT_GLU_ATOM_NUM]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue(NOT_GLU_ATOM_NUM in output)
         self.assertTrue(GLU_ATOM_NUM in output)
 def testHelp(self):
     test_input = ['-h']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertFalse(output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
Ejemplo n.º 3
0
 def testNonIntAtomNum(self):
     test_input = ["-n", "ghost", "-l", GLU_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue(
             "Could not convert specified num_atoms ('ghost') to an integer."
             in output)
 def testMMAfterQM(self):
     test_input = ["-f", GLU_FILE_MM_AFTER_QM, "-n", GLU_ATOM_NUM]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue("1429         44      0.065     -0.677     -0.401      0.789" in output)
         self.assertFalse(diff_lines(GLU_2MM_AFTER_QM_OUT, GOOD_GLU_2QM_OUT, delimiter=" "))
     finally:
         silent_remove(GLU_2MM_AFTER_QM_OUT, disable=DISABLE_REMOVE)
 def testGoodAtomNumFile(self):
     test_input = ["-f", GLU_FILE, "-n", GLU_ATOM_NUM]
     main(test_input)
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue("1429         47     -0.215      0.156     -0.387      0.470" in output)
         self.assertFalse(diff_lines(GLU_OUT1, GOOD_GLU_OUT1, delimiter=" "))
     finally:
         silent_remove(GLU_OUT1, disable=DISABLE_REMOVE)
 def testBadForceFile(self):
     test_input = ["-l", BAD_F_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("WARNING:  Did not find the expected four force values" in output)
         self.assertTrue("Check file: " in output)
         self.assertTrue("end of file without encountering the expected QMMM" in output)
         self.assertTrue("read 2 summary force sections" in output)
         self.assertTrue("WARNING:  Did not find six expected values" in output)
         self.assertTrue("WARNING:  No valid cp2k force output files were read" in output)
 def testMissingIncompleteFile(self):
     test_input = ["-l", INCOMP_F_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stderr(main, test_input) as output:
             self.assertTrue("Check file" in output)
             self.assertTrue("Could not read file" in output)
         with capture_stdout(main, test_input) as output:
             self.assertTrue("1429         47     -0.215      0.156     -0.387      0.470" in output)
         self.assertFalse(diff_lines(GLU_OUT1, GOOD_GLU_OUT1, delimiter=" "))
     finally:
         silent_remove(GLU_OUT1)
 def testGoodInput(self):
     test_input = ["-l", GLU_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue("1429         47     -0.274     -0.728     -0.387      0.470" in output)
             self.assertTrue("1429         53     -0.215      0.156      0.269      0.822" in output)
         self.assertFalse(diff_lines(GLU_SUM, GOOD_GLU_SUM))
         self.assertFalse(diff_lines(GLU_OUT1, GOOD_GLU_OUT1, delimiter=" "))
         self.assertFalse(diff_lines(GLU_OUT2, GOOD_GLU_OUT2, delimiter=" "))
     finally:
         silent_remove(GLU_SUM, disable=DISABLE_REMOVE)
         silent_remove(GLU_OUT1, disable=DISABLE_REMOVE)
         silent_remove(GLU_OUT2, disable=DISABLE_REMOVE)
 def testMissingFile(self):
     test_input = ["-f", GHOST_STRING]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Missing specified file" in output)
 def testUnregArg(self):
     test_input = ['-@@@', "-l", GLU_LIST]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("unrecognized arguments" in output)