On Monday, June 3, 2019 at 6:41:48 PM UTC-4, Mike Bayer wrote:
>
>
> It's probably better to use TypeDecorator since that keeps the two roles 
> separate.  you could also put bind/result handlers on them to assert things 
> if you wanted... 
>
>
That's a great idea; thank you!.  I'll change things in the AM.


So far this technique is working incredibly well.   It took a few hours to 
implement, but quickly solved a handful of outstanding bugs.

* Some model columns each have their own custom class.
* The various create/edit functions have assert statements to ensure the 
model columns are expected (we run production Python under `-oo`, so 
`assert` doesn't run)
* A first unittest suite ensures the model has certain columns of a certain 
type
* A second unittest suite is testing all the different text transformations 
to ensure we get the right stuff in the right place.  (Some columns allow 
markdown, others allow html, others are plaintext, etc).  


This is all in addition to all the unit tests that mock object creation.  I 
needed these tests so slight changes in encoding schemes could be quickly 
analyzed across dozens of object types.  Determining this with functional 
and integrated tests took minutes to complete the required suites; the new 
suite runs in a fraction of a second.







-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/14088109-a7f8-4d85-b25f-f9cb99952e63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to