(self, obj, compare, compare_passive=None)
| 1995 | yield _persistent_m2m_fixture |
| 1996 | |
| 1997 | def _assert_history(self, obj, compare, compare_passive=None): |
| 1998 | if isinstance(obj, self.classes.User): |
| 1999 | attrname = "addresses" |
| 2000 | elif isinstance(obj, self.classes.Order): |
| 2001 | attrname = "items" |
| 2002 | |
| 2003 | sess = inspect(obj).session |
| 2004 | |
| 2005 | if sess: |
| 2006 | sess.autoflush = False |
| 2007 | try: |
| 2008 | if self.lazy == "write_only" and compare_passive is not None: |
| 2009 | eq_( |
| 2010 | attributes.get_history( |
| 2011 | obj, attrname, PassiveFlag.PASSIVE_NO_FETCH |
| 2012 | ), |
| 2013 | compare_passive, |
| 2014 | ) |
| 2015 | else: |
| 2016 | eq_( |
| 2017 | attributes.get_history( |
| 2018 | obj, |
| 2019 | attrname, |
| 2020 | ( |
| 2021 | PassiveFlag.PASSIVE_NO_FETCH |
| 2022 | if self.lazy == "write_only" |
| 2023 | else PassiveFlag.PASSIVE_OFF |
| 2024 | ), |
| 2025 | ), |
| 2026 | compare, |
| 2027 | ) |
| 2028 | |
| 2029 | if compare_passive is None: |
| 2030 | compare_passive = compare |
| 2031 | |
| 2032 | eq_( |
| 2033 | attributes.get_history( |
| 2034 | obj, attrname, attributes.LOAD_AGAINST_COMMITTED |
| 2035 | ), |
| 2036 | compare_passive, |
| 2037 | ) |
| 2038 | finally: |
| 2039 | if sess: |
| 2040 | sess.autoflush = True |
| 2041 | |
| 2042 | def test_add_transient(self, transient_fixture): |
| 2043 | u1, a1 = transient_fixture() |
no test coverage detected