@@ -34,7 +34,7 @@ def test_save1_store():
34
34
35
35
def test_save1_load ():
36
36
obj = TestSave1 .objects .first ()
37
- SINK (obj .text )
37
+ SINK (obj .text ) # $ MISSING: flow
38
38
39
39
# --------------------------------------
40
40
# Constructor: positional arg
@@ -50,7 +50,7 @@ def test_save2_store():
50
50
51
51
def test_save2_load ():
52
52
obj = TestSave2 .objects .first ()
53
- SINK (obj .text )
53
+ SINK (obj .text ) # $ MISSING: flow
54
54
55
55
# --------------------------------------
56
56
# Constructor: positional arg, with own primary key
@@ -65,7 +65,7 @@ def test_save3_store():
65
65
66
66
def test_save3_load ():
67
67
obj = TestSave3 .objects .first ()
68
- SINK (obj .text )
68
+ SINK (obj .text ) # $ MISSING: flow
69
69
70
70
# --------------------------------------
71
71
# Set attribute on fresh object
@@ -80,7 +80,7 @@ def test_save4_store():
80
80
81
81
def test_save4_load ():
82
82
obj = TestSave4 .objects .first ()
83
- SINK (obj .text )
83
+ SINK (obj .text ) # $ MISSING: flow
84
84
85
85
# --------------------------------------
86
86
# Set attribute on existing
@@ -101,7 +101,7 @@ def test_save4b_store():
101
101
102
102
def test_save4b_load ():
103
103
obj = TestSave4b .objects .first ()
104
- SINK (obj .text )
104
+ SINK (obj .text ) # $ MISSING: flow
105
105
106
106
# --------------------------------------
107
107
# <Model>.objects.create()
@@ -113,11 +113,11 @@ class TestSave5(models.Model):
113
113
def test_save5_store ():
114
114
# note: positional args not possible
115
115
obj = TestSave5 .objects .create (text = SOURCE )
116
- SINK (obj .text )
116
+ SINK (obj .text ) # $ MISSING: flow
117
117
118
118
def test_save5_load ():
119
119
obj = TestSave5 .objects .first ()
120
- SINK (obj .text )
120
+ SINK (obj .text ) # $ MISSING: flow
121
121
122
122
# --------------------------------------
123
123
# <Model>.objects.get_or_create()
@@ -129,13 +129,13 @@ class TestSave6(models.Model):
129
129
130
130
def test_save6_store ():
131
131
obj , _created = TestSave6 .objects .get_or_create (defaults = {"text" : SOURCE }, email = SOURCE )
132
- SINK (obj .text )
133
- SINK (obj .email )
132
+ SINK (obj .text ) # $ MISSING: flow
133
+ SINK (obj .email ) # $ MISSING: flow
134
134
135
135
def test_save6_load ():
136
136
obj = TestSave6 .objects .first ()
137
- SINK (obj .text )
138
- SINK (obj .email )
137
+ SINK (obj .text ) # $ MISSING: flow
138
+ SINK (obj .email ) # $ MISSING: flow
139
139
140
140
# --------------------------------------
141
141
# <Model>.objects.update_or_create()
@@ -147,13 +147,13 @@ class TestSave7(models.Model):
147
147
148
148
def test_save7_store ():
149
149
obj , _created = TestSave7 .objects .update_or_create (defaults = {"text" : SOURCE }, email = SOURCE )
150
- SINK (obj .text )
151
- SINK (obj .email )
150
+ SINK (obj .text ) # $ MISSING: flow
151
+ SINK (obj .email ) # $ MISSING: flow
152
152
153
153
def test_save7_load ():
154
154
obj = TestSave7 .objects .first ()
155
- SINK (obj .text )
156
- SINK (obj .email )
155
+ SINK (obj .text ) # $ MISSING: flow
156
+ SINK (obj .email ) # $ MISSING: flow
157
157
158
158
# --------------------------------------
159
159
# <Model>.objects.[<QuerySet>].update()
@@ -169,7 +169,7 @@ def test_save8_store():
169
169
170
170
def test_save8_load ():
171
171
obj = TestSave8 .objects .first ()
172
- SINK (obj .text )
172
+ SINK (obj .text ) # $ MISSING: flow
173
173
174
174
# --------------------------------------
175
175
# .save() on foreign key field
@@ -192,7 +192,7 @@ def test_save9_store():
192
192
193
193
def test_save9_load ():
194
194
obj = TestSave9 .objects .first ()
195
- SINK (obj .text )
195
+ SINK (obj .text ) # $ MISSING: flow
196
196
197
197
# --------------------------------------
198
198
# foreign key backreference (auto-generated name)
@@ -219,7 +219,7 @@ def test_save10_store():
219
219
220
220
def test_save10_load ():
221
221
obj = save10_Comment .objects .first ()
222
- SINK (obj .text )
222
+ SINK (obj .text ) # $ MISSING: flow
223
223
224
224
# --------------------------------------
225
225
# foreign key backreference, with custom name
@@ -246,7 +246,7 @@ def test_save11_store():
246
246
247
247
def test_save11_load ():
248
248
obj = save11_Comment .objects .first ()
249
- SINK (obj .text )
249
+ SINK (obj .text ) # $ MISSING: flow
250
250
251
251
# ------------------------------------------------------------------------------
252
252
# Different ways to load data from the DB through the ORM
@@ -263,61 +263,61 @@ def test_load_init():
263
263
264
264
def test_load_single ():
265
265
obj = TestLoad .objects .get (id = 1 )
266
- SINK (obj .text )
266
+ SINK (obj .text ) # $ MISSING: flow
267
267
268
268
def test_load_many ():
269
269
objs = TestLoad .objects .all ()
270
270
for obj in objs :
271
- SINK (obj .text )
272
- SINK (objs [0 ].text )
271
+ SINK (obj .text ) # $ MISSING: flow
272
+ SINK (objs [0 ].text ) # $ MISSING: flow
273
273
274
274
def test_load_many_skip ():
275
275
objs = TestLoad .objects .all ()[5 :]
276
276
for obj in objs :
277
- SINK (obj .text )
278
- SINK (objs [0 ].text )
277
+ SINK (obj .text ) # $ MISSING: flow
278
+ SINK (objs [0 ].text ) # $ MISSING: flow
279
279
280
280
def test_load_qs_chain_single ():
281
281
obj = TestLoad .objects .all ().filter (text__contains = "s" ).exclude (text = None ).first ()
282
- SINK (obj .text )
282
+ SINK (obj .text ) # $ MISSING: flow
283
283
284
284
def test_load_qs_chain_many ():
285
285
objs = TestLoad .objects .all ().filter (text__contains = "s" ).exclude (text = None )
286
286
for obj in objs :
287
- SINK (obj .text )
288
- SINK (objs [0 ].text )
287
+ SINK (obj .text ) # $ MISSING: flow
288
+ SINK (objs [0 ].text ) # $ MISSING: flow
289
289
290
290
def test_load_values ():
291
291
# see https://docs.djangoproject.com/en/4.0/ref/models/querysets/#django.db.models.query.QuerySet.values
292
292
vals = TestLoad .objects .all ().values ()
293
293
for val in vals :
294
- SINK (val ['text' ])
295
- SINK (vals [0 ]['text' ])
294
+ SINK (val ['text' ]) # $ MISSING: flow
295
+ SINK (vals [0 ]['text' ]) # $ MISSING: flow
296
296
297
297
# only selecting some of the fields
298
298
vals = TestLoad .objects .all ().values ("text" )
299
299
for val in vals :
300
- SINK (val ['text' ])
301
- SINK (vals [0 ]['text' ])
300
+ SINK (val ['text' ]) # $ MISSING: flow
301
+ SINK (vals [0 ]['text' ]) # $ MISSING: flow
302
302
303
303
def test_load_values_list ():
304
304
# see https://docs.djangoproject.com/en/4.0/ref/models/querysets/#django.db.models.query.QuerySet.values_list
305
305
vals = TestLoad .objects .all ().values_list ()
306
306
for (_id , text ) in vals :
307
- SINK (text )
308
- SINK (vals [0 ][1 ])
307
+ SINK (text ) # $ MISSING: flow
308
+ SINK (vals [0 ][1 ]) # $ MISSING: flow
309
309
310
310
# only selecting some of the fields
311
311
vals = TestLoad .objects .all ().values_list ("text" )
312
312
for (text ,) in vals :
313
- SINK (text )
314
- SINK (vals [0 ][0 ])
313
+ SINK (text ) # $ MISSING: flow
314
+ SINK (vals [0 ][0 ]) # $ MISSING: flow
315
315
316
316
# with flat=True, each row will not be a tuple, but just the value
317
317
vals = TestLoad .objects .all ().values_list ("text" , flat = True )
318
318
for text in vals :
319
- SINK (text )
320
- SINK (vals [0 ])
319
+ SINK (text ) # $ MISSING: flow
320
+ SINK (vals [0 ]) # $ MISSING: flow
321
321
322
322
# Good resources:
323
323
# - https://docs.djangoproject.com/en/4.0/topics/db/queries/#making-queries
0 commit comments