MCPcopy
hub / github.com/django/django / test_integer_restriction_partial

Method test_integer_restriction_partial

tests/indexes/tests.py:416–436  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

414 editor.remove_index(index=index, model=Article)
415
416 def test_integer_restriction_partial(self):
417 with connection.schema_editor() as editor:
418 index = Index(
419 name="recent_article_idx",
420 fields=["id"],
421 condition=Q(pk__gt=1),
422 )
423 self.assertIn(
424 "WHERE %s" % editor.quote_name("id"),
425 str(index.create_sql(Article, schema_editor=editor)),
426 )
427 editor.add_index(index=index, model=Article)
428 with connection.cursor() as cursor:
429 self.assertIn(
430 index.name,
431 connection.introspection.get_constraints(
432 cursor=cursor,
433 table_name=Article._meta.db_table,
434 ),
435 )
436 editor.remove_index(index=index, model=Article)
437
438 def test_boolean_restriction_partial(self):
439 with connection.schema_editor() as editor:

Callers

nothing calls this directly

Calls 9

create_sqlMethod · 0.95
IndexClass · 0.90
QClass · 0.90
schema_editorMethod · 0.80
cursorMethod · 0.80
quote_nameMethod · 0.45
add_indexMethod · 0.45
get_constraintsMethod · 0.45
remove_indexMethod · 0.45

Tested by

no test coverage detected