Changeset d083cc
- Timestamp:
- Jan 24, 2024, 12:09:57 AM (21 months ago)
- Branches:
- Candidate_v1.7.0, stable
- Children:
- 5a479d
- Parents:
- 6dde30
- git-author:
- Frederik Heber <frederik.heber@…> (01/24/24 00:09:17)
- git-committer:
- Frederik Heber <frederik.heber@…> (01/24/24 00:09:57)
- Location:
- tests/Python
- Files:
-
- 4 edited
-
AllActions/moltest.py (modified) (4 diffs)
-
AllActions/moltest_check.py (modified) (3 diffs)
-
AllActions/testsuite-python-allactions.at (modified) (1 diff)
-
ForceAnnealing/pre/ising_model_chain.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/Python/AllActions/moltest.py
r6dde30 rd083cc 27 27 key, value = line.split('\t', 1) 28 28 except ValueError: 29 print "line needs two values, tab-separated: "+line29 print("line needs two values, tab-separated: "+line) 30 30 sys.exit(1) 31 31 value = value[1:-2] # quotes entfernen … … 46 46 47 47 if not param in Defaults: 48 print 'Fehlender Defaultwert:', param48 print('Fehlender Defaultwert:', param) 49 49 50 50 # direkt substituieren, oder erst beim aufruf? … … 59 59 params = ParseParameters(doc) 60 60 61 print '--BEGIN-- %s mit %s --------' % (cmd, params)61 print('--BEGIN-- %s mit %s --------' % (cmd, params)) 62 62 63 63 # write command to file … … 66 66 output.close() 67 67 # call python externally on this file and catch retcode 68 p = subprocess.Popen(["python ", "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)68 p = subprocess.Popen(["python3", "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) 69 69 stdout, stderr = p.communicate() 70 print ' --- STDOUT ---'71 print ' %s ' % (stdout)72 print ' --- STDERR ---'73 print ' %s ' % (stderr)70 print(' --- STDOUT ---') 71 print(' %s ' % (stdout)) 72 print(' --- STDERR ---') 73 print(' %s ' % (stderr)) 74 74 retcode = p.returncode 75 75 if retcode == 134 or retcode == 0: 76 print ' ---- ok ----'76 print(' ---- ok ----') 77 77 else: 78 print ' -- FAILED with %s --' % (retcode)78 print(' -- FAILED with %s --' % (retcode)) 79 79 # if retcode == 1: 80 80 # sys.exit(1) 81 81 #exec('mol.%s(*params)' % cmd) 82 82 83 print '---END--- %s mit %s --------' % (cmd, params)83 print('---END--- %s mit %s --------' % (cmd, params)) 84 84 85 85 sys.exit(0) -
tests/Python/AllActions/moltest_check.py
r6dde30 rd083cc 14 14 key, value = line.split('\t', 1) 15 15 except ValueError: 16 print "line needs two values, tab-separated: "+line16 print("line needs two values, tab-separated: "+line) 17 17 sys.exit(1) 18 18 value = value[1:-2] # remove quotes … … 31 31 32 32 if not param in Defaults: 33 print >> sys.stderr, param# write missing default value to stderr33 print(param, file=sys.stderr) # write missing default value to stderr 34 34 result = 1 35 35 … … 39 39 40 40 for cmd in cmds: 41 print "Checking on %s" % cmd41 print("Checking on %s" % cmd) 42 42 doc = eval('mol.%s.__doc__' % cmd) 43 43 if CheckParameters(doc) == 1: -
tests/Python/AllActions/testsuite-python-allactions.at
r6dde30 rd083cc 23 23 AT_DATA([test.py], [ 24 24 import pyMoleCuilder as mol 25 print mol.ThisCommandIsNotPresent()25 print(mol.ThisCommandIsNotPresent()) 26 26 ]) 27 27 AT_CHECK([../../run test.py], 1, [ignore], [stderr]) 28 AT_CHECK([fgrep " objecthas no attribute" stderr], 0, [ignore], [ignore])28 AT_CHECK([fgrep "has no attribute" stderr], 0, [ignore], [ignore]) 29 29 AT_CHECK([../../run ${abs_top_srcdir}/tests/Python/AllActions/listcmds.py], 0, [stdout], [ignore]) 30 30 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/Python/AllActions/options.dat .], 0, [ignore], [ignore]) -
tests/Python/ForceAnnealing/pre/ising_model_chain.py
r6dde30 rd083cc 8 8 9 9 if len(sys.argv) < 5: 10 print 'Usage: '+sys.argv[0]+' <input> <path> <steps> <no_atoms> <use bondgraph>'10 print('Usage: '+sys.argv[0]+' <input> <path> <steps> <no_atoms> <use bondgraph>') 11 11 sys.exit(1) 12 12 … … 21 21 # creating input file 22 22 atomstart=7.6-1.6*math.floor(no_atoms/2) 23 print "Creating "+inputfile23 print("Creating "+inputfile) 24 24 with open(inputfile, 'w') as f: 25 25 f.write("# ATOMDATA\ttype\tId\tx=3\tu=3\tF=3\tneighbors=4\n") … … 36 36 f.write("C\t%d\t%lg\t10\t10\t0\t0\t0\t0\t0\t0\t%d\t%d\t0\t0\n" % (i, atompos, i-1, i+1)); 37 37 38 print "Parsing from "+inputfile38 print("Parsing from "+inputfile) 39 39 mol.WorldInput(inputfile) 40 40 mol.SelectionAllAtoms() … … 53 53 print("Roots of p "+str(p)+" are "+str(zeros)) 54 54 damping=numpy.real(zeros[-1]) 55 print "Using damping factor of "+str(damping)55 print("Using damping factor of "+str(damping)) 56 56 else: 57 57 if no_atoms == 2: … … 82 82 continue 83 83 line=line.replace('\t',' ') 84 print "LINE: "+line84 print("LINE: "+line) 85 85 [elementtype, X, Y, Z] = line.split(' ', 4) 86 86 if coords!=[0.,0.,0.]: … … 88 88 coords=[float(X),float(Y),float(Z)] 89 89 except IOError: 90 print 'Warning: '+outputfile+' not readable.'90 print('Warning: '+outputfile+' not readable.') 91 91 sys.exit(1) 92 92
Note:
See TracChangeset
for help on using the changeset viewer.
