Ejemplo n.º 1
0
foo.l = []
foo.l.append(re.compile('[foo|bar]?'))
foo.l.append(re.compile('[qrs]+[1-9]?'))

foo.ul = UserList.UserList()
foo.ul.append(re.compile('[+\-][0-9]+'))
foo.ul.append(re.compile('(bored yet)?'))

foo.tup = (re.compile('this is [not]? '), re.compile('a [tuple|list]'))

#print "---PRE-PICKLE---"
#printfoo(foo)

# turn off extensions so that SREs will be saved as rawpickles
__disable_extensions()

x1 = xml_pickle.dumps(foo)
#print x1

#print "---POST-PICKLE---"
bar = xml_pickle.loads(x1)
#printfoo(bar)

checkfoo(foo, bar)

# same thing on copy
x2 = xml_pickle.dumps(bar)
baz = xml_pickle.loads(x2)

checkfoo(bar, baz)
Ejemplo n.º 2
0
foo.l = []
foo.l.append( date.DateTime(2005,6,7,8,9,10.11) )
foo.l.append( date.DateTime(2006,7,8,9,10,11.12) )

foo.ul = UserList.UserList()
foo.ul.append( date.DateTime(2007,8,9,10,11,12.13) )
foo.ul.append( date.DateTime(2008,9,10,11,12,13.14) )

foo.tup = (date.DateTime(2009,10,11,12,13,14.15),
           date.DateTime(2010,11,12,13,14,15.16))

#print "---PRE-PICKLE---"
#printfoo(foo)

__disable_extensions()

x1 = xml_pickle.dumps(foo)
#print x1

#print "---POST-PICKLE---"
bar = xml_pickle.loads(x1)
#printfoo(bar)
#bar.hi()

checkfoo(foo,bar)

# same thing on copy

x2 = xml_pickle.dumps(bar)
baz = xml_pickle.loads(x2)