MCPcopy
hub / github.com/piccolo-orm/piccolo / test_operators

Method test_operators

tests/table/test_update.py:536–561  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

534
535 @engines_skip("cockroach")
536 def test_operators(self):
537 for test_case in TEST_CASES:
538 print(test_case.description)
539
540 # Create the initial data in the database.
541 instance = MyTable()
542 setattr(instance, test_case.column._meta.name, test_case.initial)
543 instance.save().run_sync()
544
545 # Apply the update.
546 MyTable.update(
547 {test_case.column: test_case.querystring}, force=True
548 ).run_sync()
549
550 # Make sure the value returned from the database is correct.
551 new_value = getattr(
552 MyTable.objects().first().run_sync(),
553 test_case.column._meta.name,
554 )
555
556 self.assertEqual(
557 new_value, test_case.expected, msg=test_case.description
558 )
559
560 # Clean up
561 MyTable.delete(force=True).run_sync()
562
563 @sqlite_only
564 def test_edge_cases(self):

Callers

nothing calls this directly

Calls 8

saveMethod · 0.80
updateMethod · 0.80
objectsMethod · 0.80
assertEqualMethod · 0.80
deleteMethod · 0.80
MyTableClass · 0.70
run_syncMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected