コード例 #1
0
#!/usr/bin/env python

# import our dependencies only!
import sys
import traceback

# importing user code
import test

if __name__ == '__main__':
    args = sys.argv[1:]
    args_right = []
    try:
        return_val = test.abbreviate_name()
    except Exception as e:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        print("FAILED - STACKTRACE: ")
        traceback.print_exception(exc_type,
                                  exc_value,
                                  exc_traceback,
                                  limit=2,
                                  file=sys.stdout)
        sys.exit(1)
    return_data = None
    if type(return_val) is not type(return_data) or \
     return_val != return_data:
        print("FAILED - Expected : %s - Received : %s " %
              (return_data, return_val))
        sys.exit(1)
    print("PASSED - Expected : %s - Received : %s " %
          (return_data, return_val))
コード例 #2
0
ファイル: exec_test.py プロジェクト: geek101/pygrade
#!/usr/bin/env python

# import our dependencies only!
import sys
import traceback

# importing user code
import test

if __name__ == '__main__':
	args = sys.argv[1:]
	args_right = []
	args_right.append(str('Bob Alan Faria Stewart '))
	try:
		return_val = test.abbreviate_name(*args_right)
	except Exception as e:
		exc_type, exc_value, exc_traceback = sys.exc_info()
		print ("FAILED - STACKTRACE: ")
		traceback.print_exception(exc_type, exc_value, exc_traceback, limit=2, file=sys.stdout)
		sys.exit(1)
	return_data = str('Bob A. F. S. ')
	if type(return_val) is not type(return_data):
		print ("FAILED - Expected Return Type: %s - Received Return Type : %s " %
		  (type(return_data), type(return_val)))
		sys.exit(1)
	if return_val != return_data:
		print ("FAILED - Expected : %s - Received : %s " %
		  (return_data, return_val))
		sys.exit(1)
	print ("PASSED - Expected : %s - Received : %s " %
		(return_data, return_val))
コード例 #3
0
#!/usr/bin/env python

# import our dependencies only!
import sys
import traceback

# importing user code
import test

if __name__ == '__main__':
	args = sys.argv[1:]
	args_right = []
	args_right.append(str('Bob Alan Faria Stewart '))
	args_right.append(int('3'))
	try:
		return_val = test.abbreviate_name(*args_right)
	except Exception as e:
		exc_type, exc_value, exc_traceback = sys.exc_info()
		print ("FAILED - STACKTRACE: ")
		traceback.print_exception(exc_type, exc_value, exc_traceback, limit=2, file=sys.stdout)
		sys.exit(1)
	return_data = int('5')
	if type(return_val) is not type(return_data):
		print ("FAILED - Expected Return Type: %s - Received Return Type : %s " %
		  (type(return_data), type(return_val)))
		sys.exit(1)
	if return_val != return_data:
		print ("FAILED - Expected : %s - Received : %s " %
		  (return_data, return_val))
		sys.exit(1)
	print ("PASSED - Expected : %s - Received : %s " %
コード例 #4
0
ファイル: exec_test.py プロジェクト: geek101/pygrade
#!/usr/bin/env python

# import our dependencies only!
import sys
import traceback

# importing user code
import test

if __name__ == '__main__':
	args = sys.argv[1:]
	args_right = []
	try:
		return_val = test.abbreviate_name()
	except Exception as e:
		exc_type, exc_value, exc_traceback = sys.exc_info()
		print ("FAILED - STACKTRACE: ")
		traceback.print_exception(exc_type, exc_value, exc_traceback, limit=2, file=sys.stdout)
		sys.exit(1)
	return_data = None
	if type(return_val) is not type(return_data) or \
		return_val != return_data:
		print ("FAILED - Expected : %s - Received : %s " %
		  (return_data, return_val))
		sys.exit(1)
	print ("PASSED - Expected : %s - Received : %s " %
		(return_data, return_val))
	sys.exit(0)
コード例 #5
0
#!/usr/bin/env python

import sys

import test

if __name__ == '__main__':
    args = sys.argv[1:]
    args_right = []
    v1 = str(args[0])
    args_right.append(v1)
    v2 = int(args[1])
    args_right.append(v2)
    import pdb
    pdb.set_trace()
    print test.abbreviate_name(*args_right)