Skip to content

Commit 741f451

Browse files
convert some nosetest asserts into python asserts in tests
1 parent bd5b35f commit 741f451

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

tests/test_cascading_delete.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ def test_stepwise_delete():
3232
B.C().delete(force=True)
3333
assert not B.C(), 'failed to delete child tables'
3434
B().delete()
35-
assert not B(), 'failed to delete from the parent table following child table deletion'
35+
assert not B(), \
36+
'failed to delete from the parent table following child table deletion'
3637

3738
@staticmethod
3839
def test_delete_tree_restricted():
39-
assert_false(dj.config['safemode'], 'safemode must be off for testing')
40-
assert_true(L() and A() and B() and B.C() and D() and E() and E.F(),
41-
'schema is not populated')
40+
assert not dj.config['safemode'], 'safemode must be off for testing'
41+
assert L() and A() and B() and B.C() and D() and E() and E.F(), \
42+
'schema is not populated'
4243
cond = 'cond_in_a'
4344
rel = A() & cond
4445
rest = dict(
@@ -49,19 +50,14 @@ def test_delete_tree_restricted():
4950
E=len(E()-rel),
5051
F=len(E.F()-rel))
5152
rel.delete()
52-
assert_false(rel or
53-
(B() & rel) or
54-
(B.C() & rel) or
55-
(D() & rel) or
56-
(E() & rel) or
57-
(E.F() & rel),
58-
'incomplete delete')
59-
assert_equal(len(A()), rest['A'], 'invalid delete restriction')
60-
assert_equal(len(B()), rest['B'], 'invalid delete restriction')
61-
assert_equal(len(B.C()), rest['C'], 'invalid delete restriction')
62-
assert_equal(len(D()), rest['D'], 'invalid delete restriction')
63-
assert_equal(len(E()), rest['E'], 'invalid delete restriction')
64-
assert_equal(len(E.F()), rest['F'], 'invalid delete restriction')
53+
assert not (rel or B() & rel or B.C() & rel or D() & rel or E() & rel
54+
or (E.F() & rel)), 'incomplete delete'
55+
assert len(A()) == rest['A'], 'invalid delete restriction'
56+
assert len(B()) == rest['B'], 'invalid delete restriction'
57+
assert len(B.C()) == rest['C'], 'invalid delete restriction'
58+
assert len(D()) == rest['D'], 'invalid delete restriction'
59+
assert len(E()) == rest['E'], 'invalid delete restriction'
60+
assert len(E.F()) == rest['F'], 'invalid delete restriction'
6561

6662
@staticmethod
6763
def test_delete_lookup():

0 commit comments

Comments
 (0)