MCPcopy
hub / github.com/django/django / test_boolean_restriction_partial

Method test_boolean_restriction_partial

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

Source from the content-addressed store, hash-verified

436 editor.remove_index(index=index, model=Article)
437
438 def test_boolean_restriction_partial(self):
439 with connection.schema_editor() as editor:
440 index = Index(
441 name="published_index",
442 fields=["published"],
443 condition=Q(published=True),
444 )
445 self.assertIn(
446 "WHERE %s" % editor.quote_name("published"),
447 str(index.create_sql(Article, schema_editor=editor)),
448 )
449 editor.add_index(index=index, model=Article)
450 with connection.cursor() as cursor:
451 self.assertIn(
452 index.name,
453 connection.introspection.get_constraints(
454 cursor=cursor,
455 table_name=Article._meta.db_table,
456 ),
457 )
458 editor.remove_index(index=index, model=Article)
459
460 @skipUnlessDBFeature("supports_functions_in_partial_indexes")
461 def test_multiple_conditions(self):

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