@@ -101,7 +101,7 @@ def _filter_generated_classes(ret, output_test_files=False):
101101 str (f ): ret [ql_test_output_path () / f ]
102102 for f in test_files
103103 }
104- base_files -= {pathlib .Path ("IpaTypes .qll" ), pathlib . Path ( " IpaConstructors.qll " )}
104+ base_files -= {pathlib .Path (f" { name } .qll" ) for name in ( "Db" , "IpaTypes" , " IpaConstructors" )}
105105 assert stub_files == base_files
106106 return {
107107 str (f ): (ret [stub_path () / f ], ret [ql_output_path () / f ])
@@ -131,6 +131,8 @@ def test_empty(generate):
131131 children_file (): ql .GetParentImplementation (),
132132 ql_output_path () / "IpaTypes.qll" : ql .Ipa .Types (schema .root_class_name ),
133133 ql_output_path () / "IpaConstructors.qll" : ql .ImportList (),
134+ ql_output_path () / "Db.qll" : ql .DbClasses (),
135+ ql_output_path () / "Db.qll" : ql .DbClasses (),
134136 }
135137
136138
@@ -139,7 +141,7 @@ def test_one_empty_class(generate_classes):
139141 schema .Class ("A" )
140142 ]) == {
141143 "A.qll" : (ql .Stub (name = "A" , base_import = gen_import_prefix + "A" ),
142- ql .Class (name = "A" , final = True , fields = [ ql . Field ( 'id' , type = '@a' )] )),
144+ ql .Class (name = "A" , final = True )),
143145 }
144146
145147
@@ -157,7 +159,7 @@ def test_hierarchy(generate_classes):
157159 "C.qll" : (ql .Stub (name = "C" , base_import = gen_import_prefix + "C" ),
158160 ql .Class (name = "C" , bases = ["A" ], imports = [stub_import_prefix + "A" ])),
159161 "D.qll" : (ql .Stub (name = "D" , base_import = gen_import_prefix + "D" ),
160- ql .Class (name = "D" , final = True , bases = ["B" , "C" ], fields = [ ql . Field ( "id" , type = "@d" )],
162+ ql .Class (name = "D" , final = True , bases = ["B" , "C" ],
161163 imports = [stub_import_prefix + cls for cls in "BC" ])),
162164 }
163165
@@ -183,7 +185,7 @@ def test_hierarchy_children(generate_children_implementations):
183185 stub_import_prefix + "A" ]),
184186 ql .Class (name = "C" , bases = ["A" ], imports = [
185187 stub_import_prefix + "A" ]),
186- ql .Class (name = "D" , final = True , bases = ["B" , "C" ], fields = [ ql . Field ( "id" , type = "@d" )],
188+ ql .Class (name = "D" , final = True , bases = ["B" , "C" ],
187189 imports = [stub_import_prefix + cls for cls in "BC" ]),
188190 ],
189191 )
@@ -195,10 +197,10 @@ def test_single_property(generate_classes):
195197 schema .SingleProperty ("foo" , "bar" )]),
196198 ]) == {
197199 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
198- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )],
200+ ql .Class (name = "MyObject" , final = True ,
199201 properties = [
200202 ql .Property (singular = "Foo" , type = "bar" , tablename = "my_objects" ,
201- tableparams = ["id " , "result" ]),
203+ tableparams = ["this " , "result" ]),
202204 ])),
203205 }
204206
@@ -212,14 +214,14 @@ def test_single_properties(generate_classes):
212214 ]),
213215 ]) == {
214216 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
215- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )],
217+ ql .Class (name = "MyObject" , final = True ,
216218 properties = [
217219 ql .Property (singular = "One" , type = "x" , tablename = "my_objects" ,
218- tableparams = ["id " , "result" , "_" , "_" ]),
220+ tableparams = ["this " , "result" , "_" , "_" ]),
219221 ql .Property (singular = "Two" , type = "y" , tablename = "my_objects" ,
220- tableparams = ["id " , "_" , "result" , "_" ]),
222+ tableparams = ["this " , "_" , "result" , "_" ]),
221223 ql .Property (singular = "Three" , type = "z" , tablename = "my_objects" ,
222- tableparams = ["id " , "_" , "_" , "result" ]),
224+ tableparams = ["this " , "_" , "_" , "result" ]),
223225 ])),
224226 }
225227
@@ -231,9 +233,9 @@ def test_optional_property(generate_classes, is_child):
231233 schema .OptionalProperty ("foo" , "bar" , is_child = is_child )]),
232234 ]) == {
233235 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
234- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
236+ ql .Class (name = "MyObject" , final = True , properties = [
235237 ql .Property (singular = "Foo" , type = "bar" , tablename = "my_object_foos" ,
236- tableparams = ["id " , "result" ],
238+ tableparams = ["this " , "result" ],
237239 is_optional = True , is_child = is_child ),
238240 ])),
239241 }
@@ -246,9 +248,9 @@ def test_repeated_property(generate_classes, is_child):
246248 schema .RepeatedProperty ("foo" , "bar" , is_child = is_child )]),
247249 ]) == {
248250 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
249- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
251+ ql .Class (name = "MyObject" , final = True , properties = [
250252 ql .Property (singular = "Foo" , plural = "Foos" , type = "bar" , tablename = "my_object_foos" ,
251- tableparams = ["id " , "index" , "result" ], is_child = is_child ),
253+ tableparams = ["this " , "index" , "result" ], is_child = is_child ),
252254 ])),
253255 }
254256
@@ -260,9 +262,9 @@ def test_repeated_optional_property(generate_classes, is_child):
260262 schema .RepeatedOptionalProperty ("foo" , "bar" , is_child = is_child )]),
261263 ]) == {
262264 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
263- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
265+ ql .Class (name = "MyObject" , final = True , properties = [
264266 ql .Property (singular = "Foo" , plural = "Foos" , type = "bar" , tablename = "my_object_foos" ,
265- tableparams = ["id " , "index" , "result" ], is_optional = True ,
267+ tableparams = ["this " , "index" , "result" ], is_optional = True ,
266268 is_child = is_child ),
267269 ])),
268270 }
@@ -274,9 +276,9 @@ def test_predicate_property(generate_classes):
274276 schema .PredicateProperty ("is_foo" )]),
275277 ]) == {
276278 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
277- ql .Class (name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], properties = [
279+ ql .Class (name = "MyObject" , final = True , properties = [
278280 ql .Property (singular = "isFoo" , type = "predicate" , tablename = "my_object_is_foo" ,
279- tableparams = ["id " ],
281+ tableparams = ["this " ],
280282 is_predicate = True ),
281283 ])),
282284 }
@@ -291,15 +293,15 @@ def test_single_class_property(generate_classes, is_child):
291293 ]) == {
292294 "MyObject.qll" : (ql .Stub (name = "MyObject" , base_import = gen_import_prefix + "MyObject" ),
293295 ql .Class (
294- name = "MyObject" , final = True , fields = [ ql . Field ( "id" , type = "@my_object" )], imports = [stub_import_prefix + "Bar" ], properties = [
296+ name = "MyObject" , final = True , imports = [stub_import_prefix + "Bar" ], properties = [
295297 ql .Property (singular = "Foo" , type = "Bar" , tablename = "my_objects" ,
296298 tableparams = [
297- "id " , "result" ],
299+ "this " , "result" ],
298300 is_child = is_child ),
299301 ],
300302 )),
301303 "Bar.qll" : (ql .Stub (name = "Bar" , base_import = gen_import_prefix + "Bar" ),
302- ql .Class (name = "Bar" , final = True , fields = [ ql . Field ( "id" , type = "@bar" )] )),
304+ ql .Class (name = "Bar" , final = True )),
303305 }
304306
305307
@@ -312,7 +314,7 @@ def test_class_dir(generate_classes):
312314 f"{ dir } /A.qll" : (ql .Stub (name = "A" , base_import = gen_import_prefix + "another.rel.path.A" ),
313315 ql .Class (name = "A" , dir = dir )),
314316 "B.qll" : (ql .Stub (name = "B" , base_import = gen_import_prefix + "B" ),
315- ql .Class (name = "B" , final = True , fields = [ ql . Field ( "id" , type = "@b" )], bases = ["A" ],
317+ ql .Class (name = "B" , final = True , bases = ["A" ],
316318 imports = [stub_import_prefix + "another.rel.path.A" ])),
317319 }
318320
0 commit comments