MCPcopy
hub / github.com/django/django / test_gin_parameters

Method test_gin_parameters

tests/postgres_tests/test_indexes.py:340–365  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

338 )
339
340 def test_gin_parameters(self):
341 index_name = "integer_array_gin_params"
342 index = GinIndex(
343 fields=["field"],
344 name=index_name,
345 fastupdate=True,
346 gin_pending_list_limit=64,
347 db_tablespace="pg_default",
348 )
349 with connection.schema_editor() as editor:
350 editor.add_index(IntegerArrayModel, index)
351 self.assertIn(
352 ") WITH (gin_pending_list_limit = 64, fastupdate = on) TABLESPACE",
353 str(index.create_sql(IntegerArrayModel, editor)),
354 )
355 constraints = self.get_constraints(IntegerArrayModel._meta.db_table)
356 self.assertEqual(constraints[index_name]["type"], "gin")
357 self.assertEqual(
358 constraints[index_name]["options"],
359 ["gin_pending_list_limit=64", "fastupdate=on"],
360 )
361 with connection.schema_editor() as editor:
362 editor.remove_index(IntegerArrayModel, index)
363 self.assertNotIn(
364 index_name, self.get_constraints(IntegerArrayModel._meta.db_table)
365 )
366
367 def test_trigram_op_class_gin_index(self):
368 index_name = "trigram_op_class_gin"

Callers

nothing calls this directly

Calls 6

get_constraintsMethod · 0.95
GinIndexClass · 0.90
schema_editorMethod · 0.80
add_indexMethod · 0.45
create_sqlMethod · 0.45
remove_indexMethod · 0.45

Tested by

no test coverage detected