[Sqlalchemy-commits] [1260] sqlalchemy/trunk/test/attributes.py: added pickle test
Brought to you by:
zzzeek
From: <co...@sq...> - 2006-04-06 14:33:16
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[1260] sqlalchemy/trunk/test/attributes.py: added pickle test</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>1260</dd> <dt>Author</dt> <dd>zzzeek</dd> <dt>Date</dt> <dd>2006-04-06 09:32:57 -0500 (Thu, 06 Apr 2006)</dd> </dl> <h3>Log Message</h3> <pre>added pickle test</pre> <h3>Modified Paths</h3> <ul> <li><a href="#sqlalchemytrunktestattributespy">sqlalchemy/trunk/test/attributes.py</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="sqlalchemytrunktestattributespy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/test/attributes.py (1259 => 1260)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/test/attributes.py 2006-04-06 14:27:03 UTC (rev 1259) +++ sqlalchemy/trunk/test/attributes.py 2006-04-06 14:32:57 UTC (rev 1260) </span><span class="lines">@@ -2,8 +2,10 @@ </span><span class="cx"> import sqlalchemy.util as util </span><span class="cx"> import sqlalchemy.attributes as attributes </span><span class="cx"> import unittest, sys, os </span><ins>+import pickle </ins><span class="cx"> </span><span class="cx"> </span><ins>+class MyTest(object):pass </ins><span class="cx"> </span><span class="cx"> class AttributesTest(PersistTest): </span><span class="cx"> """tests for the attributes.py module, which deals with tracking attribute changes on an object.""" </span><span class="lines">@@ -36,6 +38,15 @@ </span><span class="cx"> print repr(u.__dict__) </span><span class="cx"> self.assert_(u.user_id == 7 and u.user_name == 'john' and u.email_address == 'la...@12...') </span><span class="cx"> </span><ins>+ def testpickleness(self): + manager = attributes.AttributeManager() + manager.register_attribute(MyTest, 'user_id', uselist = False) + manager.register_attribute(MyTest, 'user_name', uselist = False) + manager.register_attribute(MyTest, 'email_address', uselist = False) + x = MyTest() + x.user_id=7 + pickle.dumps(x) + </ins><span class="cx"> def testlist(self): </span><span class="cx"> class User(object):pass </span><span class="cx"> class Address(object):pass </span></span></pre> </div> </div> </body> </html> |