MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_replace

Method test_replace

test/ext/test_orderinglist.py:359–393  ·  test/ext/test_orderinglist.py::OrderingListTest.test_replace
(self)

Source from the content-addressed store, hash-verified

357 self.assert_(srt.bullets[i].text == text)
358
359 def test_replace(self):
360 self._setup(ordering_list(class="st">"position"))
361
362 s1 = Slide(class="st">"Slide class="cm">#1")
363 s1.bullets = [Bullet(class="st">"1"), Bullet(class="st">"2"), Bullet(class="st">"3")]
364
365 self.assert_(len(s1.bullets) == 3)
366 self.assert_(s1.bullets[2].position == 2)
367
368 session = fixture_session()
369 session.add(s1)
370 session.flush()
371
372 new_bullet = Bullet(class="st">"new 2")
373 self.assert_(new_bullet.position is None)
374
375 class="cm"># mark existing bullet as db-deleted before replacement.
376 class="cm"># session.delete(s1.bullets[1])
377 s1.bullets[1] = new_bullet
378
379 self.assert_(new_bullet.position == 1)
380 self.assert_(len(s1.bullets) == 3)
381
382 id_ = s1.id
383
384 session.flush()
385 session.expunge_all()
386
387 srt = session.get(Slide, id_)
388
389 self.assert_(srt.bullets)
390 self.assert_(len(srt.bullets) == 3)
391
392 self.assert_(srt.bullets[1].text == class="st">"new 2")
393 self.assert_(srt.bullets[2].text == class="st">"3")
394
395 def test_replace_two(self):
396 class="st">""class="st">"test class="cm">#3191"class="st">""

Callers

nothing calls this directly

Calls 10

_setupMethod · 0.95
ordering_listFunction · 0.90
fixture_sessionFunction · 0.90
SlideClass · 0.70
BulletClass · 0.70
assert_Method · 0.45
addMethod · 0.45
flushMethod · 0.45
expunge_allMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected