예제 #1
0
 def test_native_set(self):
     basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
     fruit = set(basket)
     p = 2
     DemoExtension.setPopTest(fruit, p)
     self.assertEqual(len(fruit), 2)
     count = 0
     if "pear" in fruit:
         count += 1
     if "apple" in fruit:
         count += 1
     if "orange" in fruit:
         count += 1
     if "banana" in fruit:
         count += 1
     self.assertEqual(count, 2)
예제 #2
0
파일: test_JyNI.py 프로젝트: whilo/JyNI
	def test_native_set(self):
		basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
		fruit = set(basket)
		p = 2
		DemoExtension.setPopTest(fruit, p)
		self.assertEqual(len(fruit), 2)
		count = 0
		if "pear" in fruit:
			count += 1
		if "apple" in fruit:
			count += 1
		if "orange" in fruit:
			count += 1
		if "banana" in fruit:
			count += 1
		self.assertEqual(count, 2)
예제 #3
0
파일: JyNIDemo.py 프로젝트: whilo/JyNI
print "(in JyNI-case see bottom for native outputs)"

print ""
print "--------Native list access writing----------"
l = ["Hello", "lovely", "world"]
print "input: "+str(l)
DemoExtension.listModifyTest(l, 2)
print "output: "+str(l)

print ""
print "--------Set testing----------"
basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
fruit = set(basket)
print fruit
p = 2
DemoExtension.setPopTest(fruit, p)
print "after popping "+str(p)+" elements:"
print fruit

print ""
print "--------Unicode testing----------"
uc = u'a\xac\u1234\u20ac\U00008000'
print type(uc)
print uc
uc2 = DemoExtension.unicodeTest(uc)
print uc2

print ""
print "--------New-style classes---------"

class testnewstyle(str):
예제 #4
0
파일: JyNIDemo.py 프로젝트: javifalces/JyNI
print "(in JyNI-case see bottom for native outputs)"

print ""
print "--------Native list access writing----------"
l = ["Hello", "lovely", "world"]
print "input: " + str(l)
DemoExtension.listModifyTest(l, 2)
print "output: " + str(l)

print ""
print "--------Set testing----------"
basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
fruit = set(basket)
print fruit
p = 2
DemoExtension.setPopTest(fruit, p)
print "after popping " + str(p) + " elements:"
print fruit

print ""
print "--------Unicode testing----------"
uc = u'a\xac\u1234\u20ac\U00008000'
print type(uc)
print uc
uc2 = DemoExtension.unicodeTest(uc)
print uc2

print ""
print "--------New-style classes---------"