(self, obj, compare, compare_passive=None)
| 1946 | yield _persistent_m2m_fixture |
| 1947 | |
| 1948 | def _assert_history(self, obj, compare, compare_passive=None): |
| 1949 | if isinstance(obj, self.classes.User): |
| 1950 | attrname = "addresses" |
| 1951 | elif isinstance(obj, self.classes.Order): |
| 1952 | attrname = "items" |
| 1953 | |
| 1954 | sess = inspect(obj).session |
| 1955 | |
| 1956 | if sess: |
| 1957 | sess.autoflush = False |
| 1958 | try: |
| 1959 | if self.lazy == "write_only" and compare_passive is not None: |
| 1960 | eq_( |
| 1961 | attributes.get_history( |
| 1962 | obj, attrname, PassiveFlag.PASSIVE_NO_FETCH |
| 1963 | ), |
| 1964 | compare_passive, |
| 1965 | ) |
| 1966 | else: |
| 1967 | eq_( |
| 1968 | attributes.get_history( |
| 1969 | obj, |
| 1970 | attrname, |
| 1971 | ( |
| 1972 | PassiveFlag.PASSIVE_NO_FETCH |
| 1973 | if self.lazy == "write_only" |
| 1974 | else PassiveFlag.PASSIVE_OFF |
| 1975 | ), |
| 1976 | ), |
| 1977 | compare, |
| 1978 | ) |
| 1979 | |
| 1980 | if compare_passive is None: |
| 1981 | compare_passive = compare |
| 1982 | |
| 1983 | eq_( |
| 1984 | attributes.get_history( |
| 1985 | obj, attrname, attributes.LOAD_AGAINST_COMMITTED |
| 1986 | ), |
| 1987 | compare_passive, |
| 1988 | ) |
| 1989 | finally: |
| 1990 | if sess: |
| 1991 | sess.autoflush = True |
| 1992 | |
| 1993 | def test_add_transient(self, transient_fixture): |
| 1994 | u1, a1 = transient_fixture() |
no test coverage detected