MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / assert_index

Method assert_index

test/ext/test_associationproxy.py:309–320  ·  view source on GitHub ↗

Assert index of child value is equal to expected. If expected is None, assert that index raises ValueError.

(expected, value, *args)

Source from the content-addressed store, hash-verified

307 p1 = Parent("P1")
308
309 def assert_index(expected, value, *args):
310 """Assert index of child value is equal to expected.
311
312 If expected is None, assert that index raises ValueError.
313 """
314 try:
315 index = p1.children.index(value, *args)
316 except ValueError:
317 self.assert_(expected is None)
318 else:
319 self.assert_(expected is not None)
320 self.assert_(index == expected)
321
322 self.assert_(not p1._children)
323 self.assert_(not p1.children)

Callers

nothing calls this directly

Calls 2

indexMethod · 0.80
assert_Method · 0.45

Tested by

no test coverage detected