Exemplo n.º 1
0
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):
	pass

nobj = testnewstyle()
print "Check conversion of new-style class: "+str(DemoExtension.newstyleCheck(nobj))
print "Check new-style is string-subtype: "+str(DemoExtension.newstyleCheckSubtype(nobj, type("")))

# Let's test instances of custom type that is not necessarily new-style class:
# from JyNI import PyShadowString
# nobj2 = PyShadowString("a", "b")
Exemplo n.º 2
0
 def test_unicode(self):
     uc = u'a\xac\u1234\u20ac\U00008000'
     uc2 = DemoExtension.unicodeTest(uc)
     self.assertEqual(uc, uc2)
Exemplo n.º 3
0
	def test_unicode(self):
		uc = u'a\xac\u1234\u20ac\U00008000'
		uc2 = DemoExtension.unicodeTest(uc)
		self.assertEqual(uc, uc2)
Exemplo n.º 4
0
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):
    pass


nobj = testnewstyle()
print "Check conversion of new-style class: " + str(
    DemoExtension.newstyleCheck(nobj))
print "Check new-style is string-subtype: " + str(
    DemoExtension.newstyleCheckSubtype(nobj, type("")))