On 08.05.2013 11:48, Vernon D. Cole wrote: > I am working on code (django-mssql) where I found the following test: > > ## expected = ( > ## Decimal('0.00'), > ## Decimal('0.0'), > ## Decimal('-0.00')) > ## > ## cur = con.cursor() > > ## cur.paramstyle = 'format' # a nonstandard extension -- VDC > > ## cur.execute("SELECT %s as A, %s as B, %s as C", expected) > ## > ## result = cur.fetchall() > ## self.assertEqual(result[0], expected) > > I added the paramstyle alteration, to match the original test's assumption > -- that is not what I am asking about. My question is: is this test > reasonable on it's face? > > I personally think that all values of zero are equal, and the user should > have no expectation that neqative zero, or an accurately precise zero, > should be returned. My present code returns three copies of Decimal(0). > > But someone must disagree, or this test would not have been written. > > What is the feeling of the group?
It's possible that the DB module passes decimals as strings to the database and the database could treat them differently in the resp. string form (e.g. raise an error in case the precision doesn't match). The test will pass either way, since all values compare equal. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 08 2013) >>> Python Projects, Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2013-05-07: Released mxODBC Zope DA 2.1.2 ... http://egenix.com/go46 2013-05-06: Released mxODBC 3.2.3 ... http://egenix.com/go45 ::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig