annotate test/test_textfmt.py @ 3681:b9301ae1c34d

Added a test case for string comparison: - For now allow both with and without case-sensitive comparison. In my test Anydbm, Metakit and MySQL compare without case while Postgres and SQLite compare with case. Maybe the collation sequence should be defined by a backend language option in the configuration? Note that this *will* be a problem when Multilink-Sorting is implemented in a generic module: In that case the string comparison will differ when Multilinks are used in a query :-( - When reviewing the source code for sorting in the various backends I discovered an obscure piece of code in back_anydb:: if isinstance(propclass, hyperdb.String): # it might be a string that's really an integer try: tv = int(v) except: v = v.lower() else: v = tv This tries to convert strings to integers. Bad. Maybe a misguided attempt at fixing the sorting by id to be numeric (no this won't do it) I've added a test that only anydbm fails. I will remove that bug in the upcoming transitive sorting.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Sun, 20 Aug 2006 10:16:03 +0000
parents f35ece8f8ff7
children 364c54991861
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3644
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
1 import unittest
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
2
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
3 from roundup.support import wrap
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
4
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
5 class WrapTestCase(unittest.TestCase):
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
6 def testWrap(self):
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
7 lorem = '''Lorem ipsum dolor sit amet, consectetuer adipiscing elit.'''
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
8 wrapped = '''Lorem ipsum dolor
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
9 sit amet,
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
10 consectetuer
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
11 adipiscing elit.'''
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
12 self.assertEquals(wrap(lorem, 20), wrapped)
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
13
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
14 def test_suite():
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
15 suite = unittest.TestSuite()
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
16 suite.addTest(unittest.makeSuite(WrapTestCase))
f35ece8f8ff7 added StringHTMLProperty wrapped() method to wrap long lines in issue display
Richard Jones <richard@users.sourceforge.net>
parents:
diff changeset
17 return suite

Roundup Issue Tracker: http://roundup-tracker.org/