fixed in r6859.  please don't use those crappy pysqlite converters.

On Feb 26, 2010, at 8:50 AM, Chris Withers wrote:

> from sqlalchemy import create_engine
> from sqlalchemy.orm import sessionmaker
> from sqlalchemy.orm.session import Session
> from sqlalchemy.ext.declarative import declarative_base
> from sqlalchemy.schema import Column
> from sqlalchemy.types import String, Numeric, Integer
> 
> import unittest
> from decimal import Decimal
> 
> class Test(unittest.TestCase):
> 
>    def test_truncate(self):
>        # setup
>        engine = create_engine("sqlite://")
>        self.Session = sessionmaker(
>            bind=engine,
>            autoflush=True,
>            autocommit=False
>            )
>        Base = declarative_base(bind=engine)
>        class MyModel(Base):
>            __tablename__ = 'test'
>            id = Column(Integer, primary_key=True)
>            value = Column(Numeric(precision=36,scale=12))
>        Base.metadata.create_all()
>        session = self.Session()
> 
>        # precision=36 scale=12 should mean this can handle 12 decimal places
>        # and this has 12 decimal places.
>        session.add(MyModel(value="152.737826714556"))
>        session.commit()
> 
>        obj = session.query(MyModel).one()
> 
>        # this will fail with the output, it shouldn't
>        # Decimal("152.737826715") != Decimal("152.737826714556")
>        self.assertEqual(obj.value, Decimal("152.737826714556"))

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to