示例#1
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsWithSpaceShouldReturnEmptyList():
	#illegal : putting space as type_category
	returnedShouldFail = test_db.getAssociatedWords(' ','Food')

	if not (isinstance(returnedShouldFail,list)):
		print "Returned object for type_category = ' ' not a list"

	if returnedShouldFail != ['Invalid category']:
		print "Returned a none empty list for the input \
示例#2
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsWithoutBothInputsShouldReturnEmptyList():
	#illegal: testing for null input for both inputs
	returnedShouldFail = test_db.getAssociatedWords('','')

	if not (isinstance(returnedShouldFail,list)):
		print "Returned object for type_category = ' ' not a list"

	if returnedShouldFail != []:
		print "Returned a none empty list for the input \
示例#3
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsWithWordAsIllegalCharactersShouldReturnEmptyList():
	#illegal: testing for word = <illegal characters>
	returnedShouldFail = test_db.getAssociatedWords('Noun','~!@#$%^&*()_+')

	if not (isinstance(returnedShouldFail,list)):
		print "Returned object for word = <illegal characters> not a list"

	if returnedShouldFail != ['']:
		print "Returned a none empty list for the input \
示例#4
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsWithIllegalCharactersShouldReturnEmptyList():
	#illegal : putting illegal characters as type_category
	returnedShouldFail = test_db.getAssociatedWords('!@$#%&^%*()_~^','Food')

	if not (isinstance(returnedShouldFail,list)):
		print "Returned object for 'type_category = illegal characters' not a list"

	if returnedShouldFail != ['Invalid category']:
		print "Returned a none empty list for the input \
示例#5
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsWithWordAsNothingShouldReturnEmptyList():
	#illegal: testing for word = ''
	returnedShouldFail = test_db.getAssociatedWords('Noun','')

	if not (isinstance(returnedShouldFail,list)):
		print "Returned object for word = '' not a list"

	if returnedShouldFail != []:
		print "Returned a none empty list for the input \
示例#6
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsForDefinitionShouldReturnListOfWords():
	returnedTest5 = test_db.getAssociatedWords('Definition','Food')

	if not (isinstance(returnedTest5,list)):
		print "Returned object for Defination not a list of strings"
示例#7
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsForAdverbShouldReturnListOfWords():
	returnedTest4 = test_db.getAssociatedWords('Adverb','Food')

	if not (isinstance(returnedTest4,list)):
		print "Returned object for Adverb not a list"
示例#8
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsForAdjectiveShouldReturnListOfWords():	
	returnedTest2 = test_db.getAssociatedWords('Adjective','Food')

	if not (isinstance(returnedTest2,list)):
		print "Returned object for Adjective not a list"
示例#9
0
文件: Tests.py 项目: stensaethf/Xword
def testGetAssociatedWordsForNounShouldReturnListOfWords():
	returnedTest1 = test_db.getAssociatedWords('Noun','Food')

	if not (isinstance(returnedTest1,list)):
		print "Returned object for Noun not a list"