Ejemplo n.º 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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
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):
Ejemplo n.º 4
0
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---------"