MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_negate_operator_label

Method test_negate_operator_label

test/sql/test_operators.py:2940–2954  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2938 is_((-self.table1.c.myid).type, self.table1.c.myid.type)
2939
2940 def test_negate_operator_label(self):
2941 orig_expr = or_(
2942 self.table1.c.myid == 1, self.table1.c.myid == 2
2943 ).label("foo")
2944 expr = not_(orig_expr)
2945 isinstance(expr, Label)
2946 eq_(expr.name, "foo")
2947 is_not(expr, orig_expr)
2948 is_(expr._element.operator, operator.inv) # e.g. and not false_
2949
2950 self.assert_compile(
2951 expr,
2952 "NOT (mytable.myid = :myid_1 OR mytable.myid = :myid_2)",
2953 dialect=default.DefaultDialect(supports_native_boolean=False),
2954 )
2955
2956 def test_negate_operator_self_group(self):
2957 orig_expr = or_(

Callers

nothing calls this directly

Calls 7

or_Function · 0.90
not_Function · 0.90
eq_Function · 0.90
is_notFunction · 0.90
is_Function · 0.90
assert_compileMethod · 0.80
labelMethod · 0.45

Tested by

no test coverage detected