Mercurial > p > roundup > code
comparison test/db_test_base.py @ 3752:c92687dce135
unicode / sqlite 3 problem [SF#1589292]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Sat, 11 Nov 2006 03:21:12 +0000 |
| parents | 44603dd791b7 |
| children | 2a60b68985db |
comparison
equal
deleted
inserted
replaced
| 3751:44603dd791b7 | 3752:c92687dce135 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: db_test_base.py,v 1.81 2006-11-11 03:01:54 richard Exp $ | 18 # $Id: db_test_base.py,v 1.82 2006-11-11 03:21:12 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets | 20 import unittest, os, shutil, errno, imp, sys, time, pprint, sets |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 199 | 199 |
| 200 # change and make sure we retrieve the correct value | 200 # change and make sure we retrieve the correct value |
| 201 self.db.file.set(nid, content='eggs') | 201 self.db.file.set(nid, content='eggs') |
| 202 if commit: self.db.commit() | 202 if commit: self.db.commit() |
| 203 self.assertEqual(self.db.file.get(nid, 'content'), 'eggs') | 203 self.assertEqual(self.db.file.get(nid, 'content'), 'eggs') |
| 204 | |
| 205 def testStringUnicode(self): | |
| 206 # test set & retrieve | |
| 207 ustr = u'\xe4\xf6\xfc\u20ac'.encode('utf8') | |
| 208 nid = self.db.issue.create(title=ustr, status='1') | |
| 209 self.assertEqual(self.db.issue.get(nid, 'title'), ustr) | |
| 210 | |
| 211 # change and make sure we retrieve the correct value | |
| 212 ustr2 = u'change \u20ac change'.encode('utf8') | |
| 213 self.db.issue.set(nid, title=ustr2) | |
| 214 self.db.commit() | |
| 215 self.assertEqual(self.db.issue.get(nid, 'title'), ustr2) | |
| 204 | 216 |
| 205 # Link | 217 # Link |
| 206 def testLinkChange(self): | 218 def testLinkChange(self): |
| 207 self.assertRaises(IndexError, self.db.issue.create, title="spam", | 219 self.assertRaises(IndexError, self.db.issue.create, title="spam", |
| 208 status='100') | 220 status='100') |
