Best Python code snippet using autotest_python
test_rr.py
Source:test_rr.py
...12class_name = "ldns_rr"13method_name = None14error_detected = False15temp_fname = "tmp_rr.txt"16def set_error():17 """18 Writes an error message and sets error flag.19 """20 global class_name21 global method_name22 global error_detected23 error_detected = True24 sys.stderr.write("(line %d): malfunctioning method %s.\n" % \25 (inspect.currentframe().f_back.f_lineno, method_name))26#if not error_detected:27if True:28 method_name = class_name + ".[comparison operators]"29 rr1 = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")30 rr2 = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")31 try:32 ret = rr1 < rr233 if not isinstance(ret, bool):34 set_error()35 if ret != True:36 set_error()37 except:38 set_error()39 try:40 ret = rr2 < rr141 if not isinstance(ret, bool):42 set_error()43 if ret != False:44 set_error()45 except:46 set_error()47 try:48 ret = rr1 <= rr249 if not isinstance(ret, bool):50 set_error()51 if ret != True:52 set_error()53 except:54 set_error()55 try:56 ret = rr2 <= rr157 if not isinstance(ret, bool):58 set_error()59 if ret != False:60 set_error()61 except:62 set_error()63 try:64 ret = rr1 == rr265 if not isinstance(ret, bool):66 set_error()67 if ret != False:68 set_error()69 except:70 set_error()71 try:72 ret = rr1 == rr173 if not isinstance(ret, bool):74 set_error()75 if ret != True:76 set_error()77 except:78 set_error()79 try:80 ret = rr1 != rr281 if not isinstance(ret, bool):82 set_error()83 if ret != True:84 set_error()85 except:86 set_error()87 try:88 ret = rr1 != rr189 if not isinstance(ret, bool):90 set_error()91 if ret != False:92 set_error()93 except:94 set_error()95 try:96 ret = rr1 > rr297 if not isinstance(ret, bool):98 set_error()99 if ret != False:100 set_error()101 except:102 set_error()103 try:104 ret = rr2 > rr1105 if not isinstance(ret, bool):106 set_error()107 if ret != True:108 set_error()109 except:110 set_error()111 try:112 ret = rr1 >= rr2113 if not isinstance(ret, bool):114 set_error()115 if ret != False:116 set_error()117 except:118 set_error()119 try:120 ret = rr2 >= rr1121 if not isinstance(ret, bool):122 set_error()123 if ret != True:124 set_error()125 except:126 set_error()127#if not error_detected:128if True:129 method_name = class_name + "__init__()"130 try:131 rr = ldns.ldns_rr()132 set_error()133 except Exception:134 pass135 except:136 set_error()137#if not error_detected:138if True:139 method_name = class_name + ".a_address()"140 rr = ldns.ldns_rr.new_frm_str("www.nic.cz 600 IN A 217.31.205.50")141 try:142 address = rr.a_address()143 if not isinstance(address, ldns.ldns_rdf):144 set_error()145 if address == None:146 set_error()147 except:148 set_error()149 rr = ldns.ldns_rr.new_frm_str("www.nic.cz 600 IN AAAA 2002:d91f:cd32::1")150 try:151 address = rr.a_address()152 if not isinstance(address, ldns.ldns_rdf):153 set_error()154 if address == None:155 set_error()156 except:157 set_error()158 rr = ldns.ldns_rr.new_frm_str("www.nic.cz 600 IN TXT text")159 try:160 address = rr.a_address()161 if isinstance(address, ldns.ldns_rdf):162 set_error()163 if address != None:164 set_error()165 except:166 set_error()167#if not error_detected:168if True:169 method_name = class_name + ".a_set_address()"170 rdf = ldns.ldns_rdf.new_frm_str("127.0.0.1", ldns.LDNS_RDF_TYPE_A)171 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")172 try:173 ret = rr.a_set_address(rdf)174 if not isinstance(ret, bool):175 set_error()176 if ret != True:177 set_error()178 except:179 set_error()180 rdf = ldns.ldns_rdf.new_frm_str("::1", ldns.LDNS_RDF_TYPE_AAAA)181 rr = ldns.ldns_rr.new_frm_str("test 600 IN AAAA ::")182 try:183 ret = rr.a_set_address(rdf)184 if not isinstance(ret, bool):185 set_error()186 if ret != True:187 set_error()188 except:189 set_error()190 try:191 ret = rr.a_set_address("")192 set_error()193 except TypeError:194 pass195 except:196 set_error()197#if not error_detected:198if True:199 method_name = class_name + ".class_by_name()"200 try:201 ret = ldns.ldns_rr.class_by_name("IN")202 if not isinstance(ret, int):203 set_error()204 if ret != ldns.LDNS_RR_CLASS_IN:205 set_error()206 except:207 set_error()208 method_name = class_name + ".class_by_name()"209 try:210 ret = ldns.ldns_rr.class_by_name("AA")211 if not isinstance(ret, int):212 set_error()213 if ret != 0:214 set_error()215 except:216 set_error()217#if not error_detected:218if True:219 method_name = class_name + ".clone()"220 rr = ldns.ldns_rr.new_frm_str("test 600 IN TXT text")221 try:222 ret = rr.clone()223 if not isinstance(ret, ldns.ldns_rr):224 set_error()225 except:226 set_error()227#if not error_detected:228if True:229 method_name = class_name + ".compare_ds()"230 pubkey1 = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")231 pubkey2 = ldns.ldns_rr.new_frm_str("example2. 3600 IN DNSKEY 256 3 3 ALBoD2+1xYpzrE7gjU5EwwBHG2HNiD1977LDZGh+8VNifMGjixMpgUN6xRhFjvRSsC/seMVXmUGq+msUDF2pHnUHbW/dbQbBxVMAqx2jT0LTvAx5wUPGltHHsa92K8VdzD8ynTFwPvjmk7g3hqRRzt4UTQIeK7DYgrOOgvDv+DYWVQctLwYP0ktm85b4cMtIUNRIf/N+K25pfK6BM/tHN8HOm4ECvm2U9zqHHfnxJFdiNK2PydkNeJZZGUOubSFVvaOMhZoEeAgkm3q5QcwXHsLAhacZ ;{id = 30944 (zsk), size = 512b}")232 ds1 = ldns.ldns_key_rr2ds(pubkey1, ldns.LDNS_SHA1)233 ds2 = ldns.ldns_key_rr2ds(pubkey2, ldns.LDNS_SHA1)234 try:235 ret = pubkey1.compare_ds(pubkey1)236 if not isinstance(ret, bool):237 set_error()238 if ret != True:239 set_error()240 except:241 set_error()242 try:243 ret = pubkey1.compare_ds(pubkey2)244 if not isinstance(ret, bool):245 set_error()246 if ret != False:247 set_error()248 except:249 set_error()250 try:251 ret = pubkey1.compare_ds(ds1)252 if not isinstance(ret, bool):253 set_error()254 if ret != True:255 set_error()256 except:257 set_error()258 try:259 ret = pubkey1.compare_ds(ds2)260 if not isinstance(ret, bool):261 set_error()262 if ret != False:263 set_error()264 except:265 set_error()266 try:267 pubkey1.compare_ds("")268 set_error()269 except TypeError:270 pass271 except:272 set_error()273#if not error_detected:274if True:275 method_name = class_name + ".compare_no_rdata()"276 rr1 = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")277 rr2 = ldns.ldns_rr.new_frm_str("test 600 IN AAAA ::")278 try:279 ret = rr1.compare_no_rdata(rr2)280 if not isinstance(ret, int):281 set_error()282 if ret != -27:283 set_error()284 except:285 set_error()286 try:287 rr1.compare_no_rdata("")288 set_error()289 except TypeError:290 pass291 except:292 set_error()293#if not error_detected:294if True:295 method_name = class_name + ".dnskey_algorithm()"296 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")297 try:298 ret = pubkey.dnskey_algorithm()299 if not isinstance(ret, ldns.ldns_rdf):300 set_error()301 except:302 set_error()303 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")304 try:305 ret = rr.dnskey_algorithm()306 if isinstance(ret, ldns.ldns_rdf):307 set_error()308 if ret != None:309 set_error()310 except:311 set_error()312#if not error_detected:313if True:314 method_name = class_name + ".dnskey_flags()"315 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")316 try:317 ret = pubkey.dnskey_flags()318 if not isinstance(ret, ldns.ldns_rdf):319 set_error()320 except:321 set_error()322 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")323 try:324 ret = rr.dnskey_flags()325 if isinstance(ret, ldns.ldns_rdf):326 set_error()327 if ret != None:328 set_error()329 except:330 set_errror()331#if not error_detected:332if True:333 method_name = class_name + ".dnskey_key()"334 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")335 try:336 ret = pubkey.dnskey_key()337 if not isinstance(ret, ldns.ldns_rdf):338 set_error()339 except:340 set_error()341 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")342 try:343 ret = rr.dnskey_key()344 if isinstance(ret, ldns.ldns_rdf):345 set_error()346 if ret != None:347 set_error()348 except:349 set_errror()350#if not error_detected:351if True:352 method_name = class_name + ".dnskey_key_size()"353 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")354 try:355 ret = pubkey.dnskey_key_size()356 if (not isinstance(ret, int)) and (not isinstance(ret, long)):357 set_error()358 if ret != 512:359 set_error()360 except:361 set_error()362 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")363 try:364 ret = rr.dnskey_key_size()365 if (not isinstance(ret, int)) and (not isinstance(ret, long)):366 set_error()367 if ret != 0:368 set_error()369 except:370 set_error()371#if not error_detected:372if True:373 method_name = class_name + ".dnskey_key_size_raw()"374 sys.stderr.write("%s not tested.\n" % (method_name))375#if not error_detected:376if True:377 method_name = class_name + ".dnskey_protocol()"378 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")379 try:380 ret = pubkey.dnskey_protocol()381 if not isinstance(ret, ldns.ldns_rdf):382 set_error()383 except:384 set_error()385 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")386 try:387 ret = rr.dnskey_protocol()388 if isinstance(ret, ldns.ldns_rdf):389 set_error()390 if ret != None:391 set_error()392 except:393 set_error()394#if not error_detected:395if True:396 method_name = class_name + ".dnskey_set_algorithm()"397 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")398 rdf = ldns.ldns_rdf.new_frm_str("3", ldns.LDNS_RDF_TYPE_ALG)399 try:400 ret = pubkey.dnskey_set_algorithm(rdf)401 if not isinstance(ret, bool):402 set_error()403 if ret != True:404 set_error()405 except:406 set_error()407# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)408# try:409# ret = pubkey.dnskey_set_algorithm(rdf)410# if not isinstance(ret, bool):411# set_error()412# if ret != False:413# set_error()414# except:415# set_error()416 try:417 ret = pubkey.dnskey_set_algorithm("")418 set_error()419 except TypeError:420 pass421 except:422 set_error()423#if not error_detected:424if True:425 method_name = class_name + ".dnskey_set_flags()"426 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")427 rdf = ldns.ldns_rdf.new_frm_str("256", ldns.LDNS_RDF_TYPE_INT16)428 try:429 ret = pubkey.dnskey_set_flags(rdf)430 if not isinstance(ret, bool):431 set_error()432 if ret != True:433 set_error()434 except:435 set_error()436# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)437# try:438# ret = pubkey.dnskey_set_flags(rdf)439# if not isinstance(ret, bool):440# set_error()441# if ret != False:442# set_error()443# except:444# set_error()445 try:446 ret = pubkey.dnskey_set_flags("")447 set_error()448 except TypeError:449 pass450 except:451 set_error()452#if not error_detected:453if True:454 method_name = class_name + ".dnskey_set_key()"455 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")456 rdf = ldns.ldns_rdf.new_frm_str("AMLdYflByPu1GEPCnu9qPTqbnC8n5mftFmFVTFQI10aefiDqp5DLpjBdTxdmz/GACMZh1+YG/iLj0QYX7qRVIl0rR00iREozqj44YwUILHo3cASSRSeAzyidvlGT8QSMKOlOsD33ygtETpzW0XDmzWhyU3bv0O7lnGpbtqdzP/nsZDbdtf5XI0YBdi91HftqtQpIlMtCg+zIzATO4+QWGt0oDX/+jdB7Y/vBahxnz13stNYeGYslGBSZNgpB7HBKlTwB70sprZ8XmNGhj/NixqB6Bzae", ldns.LDNS_RDF_TYPE_B64)457 try:458 ret = pubkey.dnskey_set_key(rdf)459 if not isinstance(ret, bool):460 set_error()461 if ret != True:462 set_error()463 except:464 set_error()465# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)466# try:467# ret = pubkey.dnskey_set_key(rdf)468# if not isinstance(ret, bool):469# set_error()470# if ret != False:471# set_error()472# except:473# set_error()474 try:475 ret = pubkey.dnskey_set_key("")476 set_error()477 except TypeError:478 pass479 except:480 set_error()481#if not error_detected:482if True:483 method_name = class_name + ".dnskey_set_protocol()"484 pubkey = ldns.ldns_rr.new_frm_str("example1. 3600 IN DNSKEY 256 3 3 APw7tG8Nf7MYXjt2Y6DmyWUVxVy73bRKvKbKoGXhAXJx2vbcGGxfXsScT0i4FIC2wsJ/8zy/otB5vymm3JHBf2+7cQvRdp12UMLAnzlfrbgZUpvV36D+q6ch7kbmFzaBfwRjOKhnZkRLCcMYPAdX1SrgKVNXaOzAl9KytbzGQs5MKEHU+a0PAwKfIvEsS/+pW6gKgBnL0uy4Gr5cYJ5rk48iwFXOlZ/B30gUS5dD+rNRJuR0ZgEkxtVIPVxxhQPtEI53JhlJ2nEy0CqNW88nYLmX402b ;{id = 34898 (zsk), size = 512b}")485 rdf = ldns.ldns_rdf.new_frm_str("3", ldns.LDNS_RDF_TYPE_INT8)486 try:487 ret = pubkey.dnskey_set_protocol(rdf)488 if not isinstance(ret, bool):489 set_error()490 if ret != True:491 set_error()492 except:493 set_error()494# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)495# try:496# ret = pubkey.dnskey_set_protocol(rdf)497# if not isinstance(ret, bool):498# set_error()499# if ret != False:500# set_error()501# except:502# set_error()503 try:504 ret = pubkey.dnskey_set_protocol("")505 set_error()506 except TypeError:507 pass508 except:509 set_error()510#if not error_detected:511if True:512 method_name = class_name + ".get_class()"513 rr = ldns.ldns_rr.new_frm_str("test IN A 0.0.0.0", 600)514 try:515 ret = rr.get_class()516 if not isinstance(ret, int):517 set_error()518 if ret != ldns.LDNS_RR_CLASS_IN:519 set_error()520 except:521 set_error()522#if not error_detected:523if True:524 method_name = class_name + ".get_class_str()"525 rr = ldns.ldns_rr.new_frm_str("test CH A 0.0.0.0", 600)526 try:527 ret = rr.get_class_str()528 if not isinstance(ret, str):529 set_error()530 if ret != "CH":531 set_error()532 except:533 set_error()534#if not error_detected:535if True:536 method_name = class_name + ".get_type()"537 rr = ldns.ldns_rr.new_frm_str("test IN A 0.0.0.0", 600)538 try:539 ret = rr.get_type()540 if not isinstance(ret, int):541 set_error()542 if ret != 1:543 set_error()544 except:545 set_error()546#if not error_detected:547if True:548 method_name = class_name + ".get_type_str()"549 rr = ldns.ldns_rr.new_frm_str("test IN A 0.0.0.0", 600)550 try:551 ret = rr.get_type_str()552 if not isinstance(ret, str):553 set_error()554 if ret != "A":555 set_error()556 except:557 set_error()558#if not error_detected:559if True:560 method_name = class_name + ".is_question()"561 rr = ldns.ldns_rr.new_frm_str("test IN A 0.0.0.0", 600)562 try:563 ret = rr.is_question()564 if not isinstance(ret, bool):565 set_error()566 if ret != False:567 set_error()568 except:569 set_error()570 rr.set_question(True)571 try:572 ret = rr.is_question()573 if not isinstance(ret, bool):574 set_error()575 if ret != True:576 set_error()577 except:578 set_error()579#if not error_detected:580if True:581 method_name = class_name + ".label_count()"582 rr = ldns.ldns_rr.new_frm_str("test.dom. IN A 0.0.0.0", 600)583 try:584 ret = rr.label_count()585 if (not isinstance(ret, int)) and (not isinstance(ret, long)):586 set_error()587 if ret != 2:588 set_error()589 except:590 set_error()591 rr = ldns.ldns_rr.new_frm_str(". IN A 0.0.0.0", 600)592 try:593 ret = rr.label_count()594 if (not isinstance(ret, int)) and (not isinstance(ret, long)):595 set_error(string)596 if ret != 0:597 set_error()598 except:599 set_error()600#if not error_detected:601if True:602 method_name = class_name + ".mx_exchange()"603 rr = ldns.ldns_rr.new_frm_str("nic.cz. IN MX 15 mail4.nic.cz.", 600)604 try:605 ret = rr.mx_exchange()606 if not isinstance(ret, ldns.ldns_rdf):607 set_error()608 except:609 set_error()610 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")611 try:612 ret = rr.mx_exchange()613 if isinstance(ret, ldns.ldns_rdf):614 set_error()615 if ret != None:616 set_error()617 except:618 set_error()619#if not error_detected:620if True:621 method_name = class_name + ".mx_preference()"622 rr = ldns.ldns_rr.new_frm_str("nic.cz. IN MX 15 mail4.nic.cz.", 600)623 try:624 ret = rr.mx_preference()625 if not isinstance(ret, ldns.ldns_rdf):626 set_error()627 except:628 set_error()629 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")630 try:631 ret = rr.mx_preference()632 if isinstance(ret, ldns.ldns_rdf):633 set_error()634 if ret != None:635 set_error()636 except:637 set_error()638#if not error_detected:639if True:640 method_name = class_name + ".new_frm_fp()"641 f = open(temp_fname, "w")642 f.write("test 600 IN A 0.0.0.0")643 f.close()644 f = open(temp_fname, "r")645 rr, ttl, origin, prev = ldns.ldns_rr.new_frm_fp(f,646 origin=ldns.ldns_dname("nic.cz"))647 try:648 # Reading past file end.649 ret = ldns.ldns_rr.new_frm_fp(f, raiseException=False)650 if ret != None:651 set_error()652 except:653 set_error()654 try:655 # Reading past file end.656 rr, ttl, origin, prev = ldns.ldns_rr.new_frm_fp(f)657 set_error()658 except Exception:659 pass660 except:661 set_error()662 f.close()663 os.remove(temp_fname)664#if not error_detected:665if True:666 method_name = class_name + ".new_frm_fp_l()"667 f = open(temp_fname, "w")668 f.write("test 600 IN A 0.0.0.0")669 f.close()670 f = open(temp_fname, "r")671 rr, line, ttl, origin, prev = ldns.ldns_rr.new_frm_fp_l(f,672 origin=ldns.ldns_dname("nic.cz"))673 try:674 # Reading past file end.675 ret = ldns.ldns_rr.new_frm_fp_l(f, raiseException=False)676 if ret != None:677 set_error()678 except:679 set_error()680 try:681 # Reading past file end.682 rr, ttl, origin, prev = ldns.ldns_rr.new_frm_fp_l(f)683 set_error()684 except Exception:685 pass686 except:687 set_error()688 f.close()689 os.remove(temp_fname)690#if not error_detected:691if True:692 method_name = class_name + ".new_frm_str()"693 try:694 rr = ldns.ldns_rr.new_frm_str("test IN A 0.0.0.0", 600,695 origin=ldns.ldns_dname("nic.cz"))696 if not isinstance(rr, ldns.ldns_rr):697 set_error()698 except:699 set_error()700 try:701 rr = ldns.ldns_rr.new_frm_str(10)702 set_error()703 except TypeError:704 pass705 except:706 set_error()707 try:708 rr = ldns.ldns_rr.new_frm_str("")709 set_error()710 except Exception:711 pass712 except:713 set_error()714 try:715 rr = ldns.ldns_rr.new_frm_str("", raiseException=False)716 if rr != None:717 set_error()718 except:719 set_error()720#if not error_detected:721if True:722 method_name = class_name + ".new_frm_str_prev()"723 try:724 rr, prev = ldns.ldns_rr.new_frm_str_prev("test IN A 0.0.0.0", 600,725 origin=ldns.ldns_dname("nic.cz"))726 if not isinstance(rr, ldns.ldns_rr):727 set_error()728# if prev != None:729# set_error()730 except:731 set_error()732 try:733 rr = ldns.ldns_rr.new_frm_str_prev(10)734 set_error()735 except TypeError:736 pass737 except:738 set_error()739 try:740 rr = ldns.ldns_rr.new_frm_str_prev("")741 set_error()742 except Exception:743 pass744 except:745 set_error()746 try:747 rr = ldns.ldns_rr.new_frm_str_prev("", raiseException=False)748 if rr != None:749 set_error()750 except:751 set_error()752#if not error_detected:753if True:754 method_name = class_name + ".new_question_frm_str()"755 try:756 rr = ldns.ldns_rr.new_question_frm_str("test IN A", 600,757 origin=ldns.ldns_dname("nic.cz"))758 if not isinstance(rr, ldns.ldns_rr):759 set_error()760 except:761 set_error()762 try:763 rr = ldns.ldns_rr.new_question_frm_str(10)764 set_error()765 except TypeError:766 pass767 except:768 set_error()769 try:770 rr = ldns.ldns_rr.new_question_frm_str("")771 set_error()772 except Exception:773 pass774 except:775 set_error()776 try:777 rr = ldns.ldns_rr.new_question_frm_str("", raiseException=False)778 if rr != None:779 set_error()780 except:781 set_error()782#if not error_detected:783if True:784 method_name = class_name + ".ns_nsdname()"785 rr = ldns.ldns_rr.new_frm_str("nic.cz. 1800 IN NS a.ns.nic.cz.")786 try:787 ret = rr.ns_nsdname()788 if not isinstance(ret, ldns.ldns_rdf):789 set_error()790 except:791 set_error()792 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")793 try:794 ret = rr.ns_nsdname()795 if isinstance(ret, ldns.ldns_rdf):796 set_error()797 if ret != None:798 set_error()799 except:800 set_error()801#if not error_detected:802if True:803 method_name = class_name + ".owner()"804 rr = ldns.ldns_rr.new_frm_str("nic.cz. 1800 IN NS a.ns.nic.cz.")805 try:806 ret = rr.owner()807 if not isinstance(ret, ldns.ldns_dname):808 set_error()809 except:810 set_error()811#if not error_detected:812if True:813 method_name = class_name + ".pop_rdf()"814 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")815 try:816 ret = rr.pop_rdf()817 if not isinstance(ret, ldns.ldns_rdf):818 set_error()819 if ret.get_type() != ldns.LDNS_RDF_TYPE_A:820 set_error()821 except:822 set_error()823 try:824 ret = rr.pop_rdf()825 if isinstance(ret, ldns.ldns_rdf):826 set_error()827 if ret != None:828 set_error()829 except:830 set_error()831#if not error_detected:832if True:833 method_name = class_name + ".print_to_file()"834 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")835 f = open(temp_fname, "w")836 try:837 rr.print_to_file(f)838 except:839 set_error()840 f.close()841 f = open(temp_fname, "r")842 if not f.readline():843 set_error()844 f.close()845 os.remove(temp_fname)846#if not error_detected:847if True:848 method_name = class_name + ".push_rdf()"849 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")850 rdf = ldns.ldns_rdf.new_frm_str("1.1.1.1", ldns.LDNS_RDF_TYPE_A)851 try:852 ret = rr.push_rdf(rdf)853 if not isinstance(ret, bool):854 set_error()855 if ret != True:856 set_error()857 except:858 set_error()859 try:860 ret = rr.push_rdf("")861 set_error()862 except TypeError:863 pass864 except:865 set_error()866#if not error_detected:867if True:868 method_name = class_name + ".rd_count()"869 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")870 try:871 ret = rr.rd_count()872 if (not isinstance(ret, int)) and (not isinstance(ret, long)):873 set_error()874 if ret != 1:875 set_error()876 except:877 set_error()878#if not error_detected:879if True:880 method_name = class_name + ".rdf()"881 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")882 try:883 ret = rr.rdf(0)884 if not isinstance(ret, ldns.ldns_rdf):885 set_error()886 except:887 set_error()888 try:889 ret = rr.rdf(1)890 if isinstance(ret, ldns.ldns_rdf):891 set_error()892 if ret != None:893 set_error()894 except:895 set_error()896#if not error_detected:897if True:898 method_name = class_name + ".rdfs()"899 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")900 try:901 ret = rr.rdfs()902 if len(list(ret)) != 1:903 set_error()904 except:905 set_error()906#if not error_detected:907if True:908 method_name = class_name + ".rrsig_algorithm()"909 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")910 try:911 ret = rr.rrsig_algorithm()912 if not isinstance(ret, ldns.ldns_rdf):913 set_error()914 except:915 set_error()916 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")917 try:918 ret = rr.rrsig_algorithm()919 if isinstance(ret, ldns.ldns_rdf):920 set_error()921 if ret != None:922 set_error()923 except:924 set_error()925#if not error_detected:926if True:927 method_name = class_name + ".rrsig_expiration()"928 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")929 try:930 ret = rr.rrsig_expiration()931 if not isinstance(ret, ldns.ldns_rdf):932 set_error()933 except:934 set_error()935 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")936 try:937 ret = rr.rrsig_expiration()938 if isinstance(ret, ldns.ldns_rdf):939 set_error()940 if ret != None:941 set_error()942 except:943 set_error()944#if not error_detected:945if True:946 method_name = class_name + ".rrsig_inception()"947 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")948 try:949 ret = rr.rrsig_inception()950 if not isinstance(ret, ldns.ldns_rdf):951 set_error()952 except:953 set_error()954 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")955 try:956 ret = rr.rrsig_inception()957 if isinstance(ret, ldns.ldns_rdf):958 set_error()959 if ret != None:960 set_error()961 except:962 set_error()963#if not error_detected:964if True:965 method_name = class_name + ".rrsig_keytag()"966 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")967 try:968 ret = rr.rrsig_keytag()969 if not isinstance(ret, ldns.ldns_rdf):970 set_error()971 except:972 set_error()973 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")974 try:975 ret = rr.rrsig_keytag()976 if isinstance(ret, ldns.ldns_rdf):977 set_error()978 if ret != None:979 set_error()980 except:981 set_error()982#if not error_detected:983if True:984 method_name = class_name + ".rrsig_labels()"985 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")986 try:987 ret = rr.rrsig_labels()988 if not isinstance(ret, ldns.ldns_rdf):989 set_error()990 except:991 set_error()992 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")993 try:994 ret = rr.rrsig_labels()995 if isinstance(ret, ldns.ldns_rdf):996 set_error()997 if ret != None:998 set_error()999 except:1000 set_error()1001#if not error_detected:1002if True:1003 method_name = class_name + ".rrsig_origttl()"1004 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1005 try:1006 ret = rr.rrsig_origttl()1007 if not isinstance(ret, ldns.ldns_rdf):1008 set_error()1009 except:1010 set_error()1011 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1012 try:1013 ret = rr.rrsig_origttl()1014 if isinstance(ret, ldns.ldns_rdf):1015 set_error()1016 if ret != None:1017 set_error()1018 except:1019 set_error()1020#if not error_detected:1021if True:1022 method_name = class_name + ".rrsig_set_algorithm()"1023 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1024 rdf = ldns.ldns_rdf.new_frm_str("3", ldns.LDNS_RDF_TYPE_ALG)1025 try:1026 ret = rr.rrsig_set_algorithm(rdf)1027 if not isinstance(ret, bool):1028 set_error()1029 if ret != True:1030 set_error()1031 except:1032 set_error()1033# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1034# try:1035# ret = rr.rrsig_set_algorithm(rdf)1036# if not isinstance(ret, bool):1037# set_error()1038# if ret != False:1039# set_error()1040# except:1041# set_error()1042 try:1043 ret = rr.rrsig_set_algorithm("")1044 set_error()1045 except TypeError:1046 pass1047 except:1048 set_error()1049#if not error_detected:1050if True:1051 method_name = class_name + ".rrsig_set_expiration()"1052 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1053 rdf = ldns.ldns_rdf.new_frm_str("20130928153754", ldns.LDNS_RDF_TYPE_TIME)1054 try:1055 ret = rr.rrsig_set_expiration(rdf)1056 if not isinstance(ret, bool):1057 set_error()1058 if ret != True:1059 set_error()1060 except:1061 set_error()1062# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1063# try:1064# ret = rr.rrsig_set_expiration(rdf)1065# if not isinstance(ret, bool):1066# set_error()1067# if ret != False:1068# set_error()1069# except:1070# set_error()1071 try:1072 ret = rr.rrsig_set_expiration("")1073 set_error()1074 except TypeError:1075 pass1076 except:1077 set_error()1078#if not error_detected:1079if True:1080 method_name = class_name + ".rrsig_set_inception()"1081 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1082 rdf = ldns.ldns_rdf.new_frm_str("20120728153754", ldns.LDNS_RDF_TYPE_TIME)1083 try:1084 ret = rr.rrsig_set_inception(rdf)1085 if not isinstance(ret, bool):1086 set_error()1087 if ret != True:1088 set_error()1089 except:1090 set_error()1091# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1092# try:1093# ret = rr.rrsig_set_inception(rdf)1094# if not isinstance(ret, bool):1095# set_error()1096# if ret != False:1097# set_error()1098# except:1099# set_error()1100 try:1101 ret = rr.rrsig_set_inception("")1102 set_error()1103 except TypeError:1104 pass1105 except:1106 set_error()1107#if not error_detected:1108if True:1109 method_name = class_name + ".rrsig_set_keytag()"1110 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1111 rdf = ldns.ldns_rdf.new_frm_str("19032", ldns.LDNS_RDF_TYPE_INT16)1112 try:1113 ret = rr.rrsig_set_keytag(rdf)1114 if not isinstance(ret, bool):1115 set_error()1116 if ret != True:1117 set_error()1118 except:1119 set_error()1120# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1121# try:1122# ret = rr.rrsig_set_keytag(rdf)1123# if not isinstance(ret, bool):1124# set_error()1125# if ret != False:1126# set_error()1127# except:1128# set_error()1129 try:1130 ret = rr.rrsig_set_keytag("")1131 set_error()1132 except TypeError:1133 pass1134 except:1135 set_error()1136#if not error_detected:1137if True:1138 method_name = class_name + ".rrsig_set_labels()"1139 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1140 rdf = ldns.ldns_rdf.new_frm_str("1", ldns.LDNS_RDF_TYPE_INT8)1141 try:1142 ret = rr.rrsig_set_labels(rdf)1143 if not isinstance(ret, bool):1144 set_error()1145 if ret != True:1146 set_error()1147 except:1148 set_error()1149# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1150# try:1151# ret = rr.rrsig_set_labels(rdf)1152# if not isinstance(ret, bool):1153# set_error()1154# if ret != False:1155# set_error()1156# except:1157# set_error()1158 try:1159 ret = rr.rrsig_set_labels("")1160 set_error()1161 except TypeError:1162 pass1163 except:1164 set_error()1165#if not error_detected:1166if True:1167 method_name = class_name + ".rrsig_set_origttl()"1168 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1169 rdf = ldns.ldns_rdf.new_frm_str("1", ldns.LDNS_RDF_TYPE_INT8)1170 try:1171 ret = rr.rrsig_set_origttl(rdf)1172 if not isinstance(ret, bool):1173 set_error()1174 if ret != True:1175 set_error()1176 except:1177 set_error()1178# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1179# try:1180# ret = rr.rrsig_set_origttl(rdf)1181# if not isinstance(ret, bool):1182# set_error()1183# if ret != False:1184# set_error()1185# except:1186# set_error()1187 try:1188 ret = rr.rrsig_set_origttl("")1189 set_error()1190 except TypeError:1191 pass1192 except:1193 set_error()1194#if not error_detected:1195if True:1196 method_name = class_name + ".rrsig_set_sig()"1197 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1198 rdf = ldns.ldns_rdf.new_frm_str("AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=", ldns.LDNS_RDF_TYPE_B64)1199 try:1200 ret = rr.rrsig_set_sig(rdf)1201 if not isinstance(ret, bool):1202 set_error()1203 if ret != True:1204 set_error()1205 except:1206 set_error()1207# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1208# try:1209# ret = rr.rrsig_set_sig(rdf)1210# if not isinstance(ret, bool):1211# set_error()1212# if ret != False:1213# set_error()1214# except:1215# set_error()1216 try:1217 ret = rr.rrsig_set_sig("")1218 set_error()1219 except TypeError:1220 pass1221 except:1222 set_error()1223#if not error_detected:1224if True:1225 method_name = class_name + ".rrsig_set_signame()"1226 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1227 rdf = ldns.ldns_rdf.new_frm_str("example.", ldns.LDNS_RDF_TYPE_DNAME)1228 try:1229 ret = rr.rrsig_set_signame(rdf)1230 if not isinstance(ret, bool):1231 set_error()1232 if ret != True:1233 set_error()1234 except:1235 set_error()1236# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1237# try:1238# ret = rr.rrsig_set_signame(rdf)1239# if not isinstance(ret, bool):1240# set_error()1241# if ret != False:1242# set_error()1243# except:1244# set_error()1245 try:1246 ret = rr.rrsig_set_signame("")1247 set_error()1248 except TypeError:1249 pass1250 except:1251 set_error()1252#if not error_detected:1253if True:1254 method_name = class_name + ".rrsig_set_typecovered()"1255 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1256 rdf = ldns.ldns_rdf.new_frm_str("SOA", ldns.LDNS_RDF_TYPE_TYPE)1257 try:1258 ret = rr.rrsig_set_typecovered(rdf)1259 if not isinstance(ret, bool):1260 set_error()1261 if ret != True:1262 set_error()1263 except:1264 set_error()1265# rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)1266# try:1267# ret = rr.rrsig_set_typecovered(rdf)1268# if not isinstance(ret, bool):1269# set_error()1270# if ret != False:1271# set_error()1272# except:1273# set_error()1274 try:1275 ret = rr.rrsig_set_typecovered("")1276 set_error()1277 except TypeError:1278 pass1279 except:1280 set_error()1281#if not error_detected:1282if True:1283 method_name = class_name + ".rrsig_sig()"1284 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1285 try:1286 ret = rr.rrsig_sig()1287 if not isinstance(ret, ldns.ldns_rdf):1288 set_error()1289 except:1290 set_error()1291 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1292 try:1293 ret = rr.rrsig_sig()1294 if isinstance(ret, ldns.ldns_rdf):1295 set_error()1296 if ret != None:1297 set_error()1298 except:1299 set_error()1300#if not error_detected:1301if True:1302 method_name = class_name + ".rrsig_signame()"1303 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1304 try:1305 ret = rr.rrsig_signame()1306 if not isinstance(ret, ldns.ldns_rdf):1307 set_error()1308 except:1309 set_error()1310 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1311 try:1312 ret = rr.rrsig_signame()1313 if isinstance(ret, ldns.ldns_rdf):1314 set_error()1315 if ret != None:1316 set_error()1317 except:1318 set_error()1319#if not error_detected:1320if True:1321 method_name = class_name + ".rrsig_typecovered()"1322 rr = ldns.ldns_rr.new_frm_str("example. 600 IN RRSIG SOA 3 1 600 20130828153754 20120828153754 19031 example. AIoCFhwZJxIgYOBEyo3cxxWFZEsUPqkxnt38xEl1cFAHHC9iQN9mlEg=")1323 try:1324 ret = rr.rrsig_typecovered()1325 if not isinstance(ret, ldns.ldns_rdf):1326 set_error()1327 except:1328 set_error()1329 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1330 try:1331 ret = rr.rrsig_typecovered()1332 if isinstance(ret, ldns.ldns_rdf):1333 set_error()1334 if ret != None:1335 set_error()1336 except:1337 set_error()1338#if not error_detected:1339if True:1340 method_name = class_name + ".set_class()"1341 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1342 try:1343 rr.set_class(ldns.LDNS_RR_CLASS_CH)1344 except:1345 set_error()1346 try:1347 rr.set_class("")1348 set_error()1349 except TypeError:1350 pass1351 except:1352 set_error()1353#if not error_detected:1354if True:1355 method_name = class_name + ".set_owner()"1356 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1357 rdf = ldns.ldns_dname("test2")1358 try:1359 rr.set_owner(rdf)1360 except:1361 set_error()1362 try:1363 rr.set_owner("")1364 set_error()1365 except TypeError:1366 pass1367 except:1368 set_error()1369#if not error_detected:1370if True:1371 method_name = class_name + ".set_question()"1372 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1373 try:1374 rr.set_question(True)1375 except:1376 set_error()1377#if not error_detected:1378if True:1379 method_name = class_name + ".set_rd_count()"1380 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1381 try:1382 rr.set_rd_count(1)1383 except:1384 set_error()1385 try:1386 rr.set_rd_count("")1387 set_error()1388 except TypeError:1389 pass1390 except:1391 set_error()1392#if not error_detected:1393if True:1394 method_name = class_name + ".set_rdf()"1395 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1396 rdf = ldns.ldns_rdf.new_frm_str("1.1.1.1", ldns.LDNS_RDF_TYPE_A)1397 rr.push_rdf(rdf)1398 try:1399 ret = rr.set_rdf(rdf, 0)1400 if not isinstance(ret, ldns.ldns_rdf):1401 set_error()1402 except:1403 set_error()1404 try:1405 ret = rr.set_rdf(rdf, 2)1406 if isinstance(ret, ldns.ldns_rdf):1407 set_error()1408 if ret != None:1409 set_error()1410 except:1411 set_error()1412 try:1413 rr.set_rdf("", 1)1414 set_error()1415 except TypeError:1416 pass1417 except:1418 set_error()1419#if not error_detected:1420if True:1421 method_name = class_name + ".set_ttl()"1422 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1423 try:1424 rr.set_ttl(1)1425 except:1426 set_error()1427 try:1428 rr.set_ttl("")1429 set_error()1430 except TypeError:1431 pass1432 except:1433 set_error()1434#if not error_detected:1435if True:1436 method_name = class_name + ".set_type()"1437 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1438 try:1439 rr.set_type(ldns.LDNS_RR_TYPE_A)1440 except:1441 set_error()1442 try:1443 rr.set_type("")1444 set_error()1445 except TypeError:1446 pass1447 except:1448 set_error()1449#if not error_detected:1450if True:1451 method_name = class_name + ".to_canonical()"1452 rr = ldns.ldns_rr.new_frm_str("TEST 600 IN A 0.0.0.0")1453 try:1454 rr.to_canonical()1455 except:1456 set_error()1457#if not error_detected:1458if True:1459 method_name = class_name + ".ttl()"1460 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1461 try:1462 ret = rr.ttl()1463 if not isinstance(ret, int):1464 set_error()1465 if ret != 600:1466 set_error()1467 except:1468 set_error()1469#if not error_detected:1470if True:1471 method_name = class_name + ".type_by_name()"1472 try:1473 ret = ldns.ldns_rr.type_by_name("A")1474 if not isinstance(ret, int):1475 set_error()1476 if ret != ldns.LDNS_RR_TYPE_A:1477 set_error()1478 except:1479 set_error()1480 try:1481 ret = ldns.ldns_rr.type_by_name("AA")1482 if not isinstance(ret, int):1483 set_error()1484 if ret != 0:1485 set_error()1486 except:1487 set_error()1488 try:1489 ret = ldns.ldns_rr.type_by_name(1)1490 set_error()1491 except TypeError:1492 pass1493 except:1494 set_error()1495#if not error_detected:1496if True:1497 method_name = class_name + ".uncompressed_size()"1498 rr = ldns.ldns_rr.new_frm_str("test 600 IN A 0.0.0.0")1499 try:1500 ret = rr.uncompressed_size()1501 if (not isinstance(ret, int)) and (not isinstance(ret, long)):1502 set_error()1503 if ret != 20:1504 set_error()1505 except:1506 set_error()1507#if not error_detected:1508if True:1509 method_name = class_name + ".write_data_to_buffer()"1510 sys.stderr.write("%s not tested.\n" % (method_name))1511#if not error_detected:1512if True:1513 method_name = class_name + ".write_rrsig_to_buffer()"1514 sys.stderr.write("%s not tested.\n" % (method_name))1515#if not error_detected:1516if True:1517 method_name = class_name + ".write_to_buffer()"1518 sys.stderr.write("%s not tested.\n" % (method_name))1519#if not error_detected:1520if True:1521 method_name = class_name + ".write_to_buffer_canonical()"1522 sys.stderr.write("%s not tested.\n" % (method_name))1523###############################################################################1524###############################################################################1525class_name = "ldns_rr_descriptor"1526method_name = None1527error_detected = False1528temp_fname = "tmp_rr_descriptor.txt"1529#if not error_detected:1530if True:1531 method_name = class_name + ".field_type()"1532 desc_a = ldns.ldns_rr_descriptor.ldns_rr_descriptor(ldns.LDNS_RR_TYPE_A)1533 try:1534 ret = desc_a.field_type(0)1535 if not isinstance(ret, int):1536 set_error()1537 if ret != ldns.LDNS_RDF_TYPE_A:1538 set_error()1539 except:1540 set_error()1541 try:1542 ret = desc_a.field_type("")1543 set_error()1544 except TypeError:1545 pass1546 except:1547 set_error()1548#if not error_detected:1549if True:1550 method_name = class_name + ".ldns_rr_descriptor()"1551 try:1552 ret = ldns.ldns_rr_descriptor.ldns_rr_descriptor(ldns.LDNS_RR_TYPE_A)1553 if not isinstance(ret, ldns.ldns_rr_descriptor):1554 set_error()1555 except:1556 set_error()1557#if not error_detected:1558if True:1559 method_name = class_name + ".maximum()"1560 desc_a = ldns.ldns_rr_descriptor.ldns_rr_descriptor(ldns.LDNS_RR_TYPE_A)1561 try:1562 ret = desc_a.maximum()1563 if (not isinstance(ret, int)) and (not isinstance(ret, long)):1564 set_error()1565 if ret != 1:1566 set_error()1567 except:1568 set_error()1569#if not error_detected:1570if True:1571 method_name = class_name + ".minimum()"1572 desc_a = ldns.ldns_rr_descriptor.ldns_rr_descriptor(ldns.LDNS_RR_TYPE_A)1573 try:1574 ret = desc_a.minimum()1575 if (not isinstance(ret, int)) and (not isinstance(ret, long)):1576 set_error()1577 if ret != 1:1578 set_error()1579 except:1580 set_error()1581###############################################################################1582###############################################################################1583class_name = "ldns_rr_list"1584method_name = None1585error_detected = False1586temp_fname = "tmp_rr_list.txt"1587#if not error_detected:1588if True:1589 method_name = class_name + ".[comparison operators]"1590 rrl1 = ldns.ldns_rr_list.new()1591 rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))1592 rrl2 = ldns.ldns_rr_list.new()1593 rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))1594 try:1595 ret = rrl1 < rrl21596 if not isinstance(ret, bool):1597 set_error()1598 if ret != True:1599 set_error()1600 except:1601 set_error()1602 try:1603 ret = rrl2 < rrl11604 if not isinstance(ret, bool):1605 set_error()1606 if ret != False:1607 set_error()1608 except:1609 set_error()1610 try:1611 ret = rrl1 <= rrl21612 if not isinstance(ret, bool):1613 set_error()1614 if ret != True:1615 set_error()1616 except:1617 set_error()1618 try:1619 ret = rrl2 <= rrl11620 if not isinstance(ret, bool):1621 set_error()1622 if ret != False:1623 set_error()1624 except:1625 set_error()1626 try:1627 ret = rrl1 == rrl21628 if not isinstance(ret, bool):1629 set_error()1630 if ret != False:1631 set_error()1632 except:1633 set_error()1634 try:1635 ret = rrl1 == rrl11636 if not isinstance(ret, bool):1637 set_error()1638 if ret != True:1639 set_error()1640 except:1641 set_error()1642 try:1643 ret = rrl1 != rrl21644 if not isinstance(ret, bool):1645 set_error()1646 if ret != True:1647 set_error()1648 except:1649 set_error()1650 try:1651 ret = rrl1 != rrl11652 if not isinstance(ret, bool):1653 set_error()1654 if ret != False:1655 set_error()1656 except:1657 set_error()1658 try:1659 ret = rrl1 > rrl21660 if not isinstance(ret, bool):1661 set_error()1662 if ret != False:1663 set_error()1664 except:1665 set_error()1666 try:1667 ret = rrl2 > rrl11668 if not isinstance(ret, bool):1669 set_error()1670 if ret != True:1671 set_error()1672 except:1673 set_error()1674 try:1675 ret = rrl1 >= rrl21676 if not isinstance(ret, bool):1677 set_error()1678 if ret != False:1679 set_error()1680 except:1681 set_error()1682 try:1683 ret = rrl2 >= rrl11684 if not isinstance(ret, bool):1685 set_error()1686 if ret != True:1687 set_error()1688 except:1689 set_error()1690#if not error_detected:1691if True:1692 method_name = class_name + ".cat()"1693 rrl1 = ldns.ldns_rr_list.new()1694 rrl2 = ldns.ldns_rr_list.new()1695 rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))1696 rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))1697 try:1698 ret = rrl1.cat(rrl2)1699 if not isinstance(ret, bool):1700 set_error()1701 if ret != True:1702 set_error()1703 except:1704 set_error()1705 try:1706 ret = rrl2.cat("")1707 set_error()1708 except TypeError:1709 pass1710 except:1711 set_error()1712#if not error_detected:1713if True:1714 method_name = class_name + ".cat_clone()"1715 rrl1 = ldns.ldns_rr_list.new()1716 rrl2 = ldns.ldns_rr_list.new()1717 rrl1.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))1718 rrl2.push_rr(ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1"))1719 try:1720 ret = rrl1.cat_clone(rrl2)1721 if not isinstance(ret, ldns.ldns_rr_list):1722 set_error()1723 except:1724 set_error()1725 try:1726 ret = rrl2.cat_clone("")1727 set_error()1728 except TypeError:1729 pass1730 except:1731 set_error()1732#if not error_detected:1733if True:1734 method_name = class_name + ".clone()"1735 rrl = ldns.ldns_rr_list.new()1736 rrl.push_rr(ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0"))1737 try:1738 ret = rrl.clone()1739 if not isinstance(ret, ldns.ldns_rr_list):1740 set_error()1741 except:1742 set_error()1743#if not error_detected:1744if True:1745 method_name = class_name + ".contains_rr()"1746 rrl = ldns.ldns_rr_list.new()1747 rr1 = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1748 rr2 = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")1749 rrl.push_rr(rr1)1750 try:1751 ret = rrl.contains_rr(rr1)1752 if not isinstance(ret, bool):1753 set_error()1754 if ret != True:1755 set_error()1756 except:1757 set_error()1758 try:1759 ret = rrl.contains_rr(rr2)1760 if not isinstance(ret, bool):1761 set_error()1762 if ret != False:1763 set_error()1764 except:1765 set_error()1766 try:1767 ret = rrl.contains_rr("")1768 set_error()1769 except TypeError:1770 pass1771 except:1772 set_error()1773#if not error_detected:1774if True:1775 method_name = class_name + ".is_rrset()"1776 rrl = ldns.ldns_rr_list.new()1777 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1778 rrl.push_rr(rr)1779 try:1780 ret = rrl.is_rrset()1781 if not isinstance(ret, bool):1782 set_error()1783 if ret != True:1784 set_error()1785 except:1786 set_error()1787#if not error_detected:1788if True:1789 method_name = class_name + ".new()"1790 try:1791 ret = ldns.ldns_rr_list.new()1792 if not isinstance(ret, ldns.ldns_rr_list):1793 set_error()1794 except:1795 set_error()1796#if not error_detected:1797if True:1798 method_name = class_name + ".new_frm_file()"1799 try:1800 ret = ldns.ldns_rr_list.new_frm_file()1801 if not isinstance(ret, ldns.ldns_rr_list):1802 set_error()1803 except:1804 set_error()1805 try:1806 ret = ldns.ldns_rr_list.new_frm_file("test")1807 set_error()1808 except Exception:1809 pass1810 except:1811 set_error()1812 try:1813 ret = ldns.ldns_rr_list.new_frm_file("test", raiseException=False)1814 if isinstance(ret, ldns.ldns_rr_list):1815 set_error()1816 if ret != None:1817 set_error()1818 except:1819 set_error()1820#if not error_detected:1821if True:1822 method_name = class_name + ".owner()"1823 rrl = ldns.ldns_rr_list.new()1824 try:1825 ret = rrl.owner()1826 if isinstance(ret, ldns.ldns_rdf):1827 set_error()1828 if ret != None:1829 set_error()1830 except:1831 set_error()1832 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1833 rrl.push_rr(rr)1834 try:1835 ret = rrl.owner()1836 if not isinstance(ret, ldns.ldns_dname):1837 set_error()1838 except:1839 set_error()1840#if not error_detected:1841if True:1842 method_name = class_name + ".pop_rr()"1843 rrl = ldns.ldns_rr_list.new()1844 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1845 rrl.push_rr(rr)1846 try:1847 ret = rrl.pop_rr()1848 if not isinstance(ret, ldns.ldns_rr):1849 set_error()1850 except:1851 set_error()1852 try:1853 ret = rrl.pop_rr()1854 if isinstance(ret, ldns.ldns_rr):1855 set_error()1856 if ret != None:1857 set_error()1858 except:1859 set_error()1860#if not error_detected:1861if True:1862 method_name = class_name + ".pop_rr_list()"1863 rrl = ldns.ldns_rr_list.new()1864 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1865 rrl.push_rr(rr)1866 rrl.push_rr(rr)1867 rrl.push_rr(rr)1868 try:1869 ret = rrl.pop_rr_list(2)1870 if not isinstance(ret, ldns.ldns_rr_list):1871 set_error()1872 except:1873 set_error()1874 try:1875 ret = rrl.pop_rr_list(2)1876 if not isinstance(ret, ldns.ldns_rr_list):1877 set_error()1878 except:1879 set_error()1880 try:1881 ret = rrl.pop_rr_list(2)1882 if isinstance(ret, ldns.ldns_rr_list):1883 set_error()1884 if ret != None:1885 set_error()1886 except:1887 set_error()1888 try:1889 ret = rrl.pop_rr_list("")1890 set_error()1891 except TypeError:1892 pass1893 except:1894 set_error()1895#if not error_detected:1896if True:1897 method_name = class_name + ".pop_rrset()"1898 rrl = ldns.ldns_rr_list.new()1899 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1900 rrl.push_rr(rr)1901 rrl.push_rr(rr)1902 rrl.push_rr(rr)1903 try:1904 ret = rrl.pop_rrset()1905 if not isinstance(ret, ldns.ldns_rr_list):1906 set_error()1907 except:1908 set_error()1909 try:1910 ret = rrl.pop_rrset()1911 if isinstance(ret, ldns.ldns_rr_list):1912 set_error()1913 if ret != None:1914 set_error()1915 except:1916 set_error()1917#if not error_detected:1918if True:1919 method_name = class_name + ".print_to_file()"1920 rrl = ldns.ldns_rr_list.new()1921 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1922 rrl.push_rr(rr)1923 rrl.push_rr(rr)1924 rrl.push_rr(rr)1925 f = open(temp_fname, "w")1926 try:1927 rrl.print_to_file(f)1928 except:1929 set_error()1930 f.close()1931 f = open(temp_fname, "r")1932 if len(f.readlines()) != 3:1933 set_error()1934 f.close()1935 os.remove(temp_fname)1936#if not error_detected:1937if True:1938 method_name = class_name + ".push_rr()"1939 rrl = ldns.ldns_rr_list.new()1940 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1941 try:1942 ret = rrl.push_rr(rr)1943 if not isinstance(ret, bool):1944 set_error()1945 if ret != True:1946 set_error()1947 except:1948 set_error()1949 try:1950 ret = rrl.push_rr("")1951 set_error()1952 except TypeError:1953 pass1954 except:1955 set_error()1956#if not error_detected:1957if True:1958 method_name = class_name + ".push_rr_list()"1959 rrl1 = ldns.ldns_rr_list.new()1960 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1961 rrl1.push_rr(rr)1962 rrl2 = rrl1.new()1963 try:1964 ret = rrl1.push_rr_list(rrl2)1965 if not isinstance(ret, bool):1966 set_error()1967 if ret != True:1968 set_error()1969 except:1970 set_error()1971 try:1972 ret = rrl.push_rr_list("")1973 set_error()1974 except TypeError:1975 pass1976 except:1977 set_error()1978#if not error_detected:1979if True:1980 method_name = class_name + ".rr()"1981 rrl = ldns.ldns_rr_list.new()1982 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")1983 rrl.push_rr(rr)1984 try:1985 ret = rrl.rr(0)1986 if not isinstance(ret, ldns.ldns_rr):1987 set_error()1988 except:1989 set_error()1990 try:1991 ret = rrl.rr(1)1992 if isinstance(ret, ldns.ldns_rr):1993 set_error()1994 if ret != None:1995 set_error()1996 except:1997 set_error()1998#if not error_detected:1999if True:2000 method_name = class_name + ".rr_count()"2001 rrl = ldns.ldns_rr_list.new()2002 try:2003 ret = rrl.rr_count()2004 if (not isinstance(ret, int)) and (not isinstance(ret, long)):2005 set_error()2006 if ret != 0:2007 set_error()2008 except:2009 set_error()2010 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")2011 rrl.push_rr(rr)2012 try:2013 ret = rrl.rr_count()2014 if (not isinstance(ret, int)) and (not isinstance(ret, long)):2015 set_error()2016 if ret != 1:2017 set_error()2018 except:2019 set_error()2020#if not error_detected:2021if True:2022 method_name = class_name + ".rrs()"2023 rrl = ldns.ldns_rr_list.new()2024 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")2025 rrl.push_rr(rr)2026 rrl.push_rr(rr)2027 try:2028 ret = list(rrl.rrs())2029 if not isinstance(ret, list):2030 set_error()2031 if len(ret) != 2:2032 set_error()2033 except:2034 set_error()2035#if not error_detected:2036if True:2037 method_name = class_name + ".set_rr()"2038 rrl = ldns.ldns_rr_list.new()2039 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")2040 rrl.push_rr(rr)2041 rr = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")2042 ret = rrl.set_rr(rr, 0)2043 try:2044 ret = rrl.set_rr(rr, 0)2045 if not isinstance(ret, ldns.ldns_rr):2046 set_error()2047 except:2048 set_error()2049 try:2050 ret = rrl.set_rr(rr, 1)2051 if isinstance(ret, ldns.ldns_rr):2052 set_error()2053 if ret != None:2054 set_error()2055 except:2056 set_error()2057 try:2058 ret = rrl.set_rr("", 1)2059 set_error()2060 except TypeError:2061 pass2062 except:2063 set_error()2064#if not error_detected:2065if True:2066 method_name = class_name + ".set_rr_count()"2067 rrl = ldns.ldns_rr_list.new()2068 try:2069 rrl.set_rr_count(0)2070 except:2071 set_error()2072 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")2073 rrl.push_rr(rr)2074 try:2075 rrl.set_rr_count("")2076 except TypeError:2077 pass2078 except:2079 set_error()2080#if not error_detected:2081if True:2082 method_name = class_name + ".sort()"2083 rrl = ldns.ldns_rr_list.new()2084 try:2085 rrl.sort()2086 except:2087 set_error()2088#if not error_detected:2089if True:2090 method_name = class_name + ".subtype_by_rdf()"2091 rrl = ldns.ldns_rr_list.new()2092 rr = ldns.ldns_rr.new_frm_str("test1 600 IN A 0.0.0.0")2093 rrl.push_rr(rr)2094 rr = ldns.ldns_rr.new_frm_str("test2 600 IN A 1.1.1.1")2095 rrl.push_rr(rr)2096 rr = ldns.ldns_rr.new_frm_str("test3 600 IN A 0.0.0.0")2097 rrl.push_rr(rr)2098 rdf = ldns.ldns_rdf.new_frm_str("0.0.0.0", ldns.LDNS_RDF_TYPE_A)2099 try:2100 ret = rrl.subtype_by_rdf(rdf, 0)2101 if not isinstance(ret, ldns.ldns_rr_list):2102 set_error()2103 if ret.rr_count() != 2:2104 set_error()2105 except:2106 set_error()2107 rdf = ldns.ldns_rdf.new_frm_str("::", ldns.LDNS_RDF_TYPE_AAAA)2108 try:2109 ret = rrl.subtype_by_rdf(rdf, 0)2110 if isinstance(ret, ldns.ldns_rr_list):2111 set_error()2112 if ret != None:2113 set_error()2114 except:2115 set_error()2116 try:2117 ret = rrl.subtype_by_rdf("", 0)2118 set_error()2119 except TypeError:2120 pass2121 except:2122 set_error()2123#if not error_detected:2124if True:2125 method_name = class_name + ".to_canonical()"2126 rrl = ldns.ldns_rr_list.new()2127 rr = ldns.ldns_rr.new_frm_str("TEST1 600 IN A 0.0.0.0")2128 rrl.push_rr(rr)2129 try:2130 rrl.to_canonical()2131 except:2132 set_error()2133#if not error_detected:2134if True:2135 method_name = class_name + ".type()"2136 rrl = ldns.ldns_rr_list.new()2137 try:2138 ret = rrl.type()2139 if not isinstance(ret, int):2140 set_error()2141 if ret != 0:2142 set_error()2143 except:2144 set_error()2145 rr = ldns.ldns_rr.new_frm_str("TEST1 600 IN A 0.0.0.0")2146 rrl.push_rr(rr)2147 try:2148 ret = rrl.type()2149 if not isinstance(ret, int):2150 set_error()2151 if ret != ldns.LDNS_RR_TYPE_A:2152 set_error()2153 except:2154 set_error()2155#if not error_detected:2156if True:2157 method_name = class_name + ".write_to_buffer()"2158 sys.stderr.write("%s not tested.\n" % (method_name))2159if not error_detected:2160 sys.stdout.write("%s: passed.\n" % (os.path.basename(__file__)))2161else:2162 sys.stdout.write("%s: errors detected.\n" % (os.path.basename(__file__)))...
test_buffer.py
Source:test_buffer.py
...11import inspect12class_name = "ldns_buffer"13method_name = None14error_detected = False15def set_error():16 """17 Writes an error message and sets error flag.18 """19 global class_name20 global method_name21 global error_detected22 error_detected = True23 sys.stderr.write("(line %d): malfunctioning method %s.\n" % \24 (inspect.currentframe().f_back.f_lineno, method_name))25 26# Buffer creation.27capacity = 102428#if not error_detected:29if True:30 method_name = "ldns_buffer.__init__()"31 try:32 buf = ldns.ldns_buffer(1024)33 except:34 set_error()35#if not error_detected:36if True:37 method_name = "ldns_buffer.__str__()"38 buf.printf("abcedf")39 try:40 string = buf.__str__()41 except:42 set_error()43 if not isinstance(string, str):44 # Should be string.45 set_error()46 buf.clear()47#if not error_detected:48if True:49 method_name = "ldns_buffer.at()"50 try:51 ret = buf.at(512)52 except:53 set_error()54 try:55 # Must raise TypeError.56 ret = buf.at("")57 set_error()58 except TypeError:59 pass60 except:61 set_error()62#if not error_detected:63if True:64 method_name = "ldns_buffer.available()"65 try:66 ret = buf.available(capacity)67 except:68 set_error()69 if not isinstance(ret, bool):70 # Should be bool.71 set_error()72 if not buf.available(capacity):73 # Should return True.74 set_error()75 if buf.available(capacity + 1):76 # Should return False.77 set_error()78 try:79 # Must raise TypeError.80 ret = buf.available("")81 set_error()82 except TypeError:83 pass84 except:85 set_error()86# try:87# # Must raise ValueError.88# ret = buf.available("")89# set_error()90# except ValueError:91# pass92# except:93# set_error()94#if not error_detected:95if True:96 method_name = "ldns_buffer.available_at()"97 try:98 ret = buf.available_at(512, capacity - 512)99 except:100 set_error()101 if not isinstance(ret, bool):102 # Should be bool.103 set_error()104 if not buf.available_at(512, capacity - 512):105 # Should return True.106 set_error()107 if buf.available_at(512, capacity - 512 + 1):108 # Should return False.109 set_error()110 try:111 # Must raise TypeError.112 ret = buf.available_at("", 1)113 set_error()114 except TypeError:115 pass116 except:117 set_error()118 try:119 # Must raise TypeError.120 ret = buf.available_at(1, "")121 set_error()122 except TypeError:123 pass124 except:125 set_error()126# try:127# # Must raise ValueError.128# ret = buf.available_at(-1, 512)129# set_error()130# except ValueError:131# pass132# except:133# set_error()134# try:135# # Must raise ValueError.136# ret = buf.available_at(512, -1)137# set_error()138# except ValueError:139# pass140# except:141# set_error()142#if not error_detected:143if True:144 method_name = "ldns_buffer.begin()"145 try:146 ret = buf.begin()147 except:148 set_error()149#if not error_detected:150if True:151 method_name = "ldns_buffer.capacity()"152 try:153 ret = buf.capacity()154 except:155 set_error()156 if (not isinstance(ret, int)) and (not isinstance(ret, long)):157 # Should be int.158 set_error()159#if not error_detected:160if True:161 method_name = "ldns_buffer.clear()"162 try:163 buf.clear()164 except:165 set_error()166#if not error_detected:167if True:168 method_name = "ldns_buffer.copy()"169 sys.stderr.write("%s not tested.\n" % (method_name))170# buf2 = ldns.ldns_buffer(10)171# buf2.printf("abcdef")172# try:173# buf.copy(buf2)174# print buf.capacity()175# print buf2.capacity()176# except:177# set_error()178# buf.printf("2")179# print buf180#if not error_detected:181if True:182 method_name = "ldns_buffer.current()"183 try:184 ret = buf.current()185 except:186 set_error()187#if not error_detected:188if True:189 method_name = "ldns_buffer.end()"190 try:191 ret = buf.end()192 except:193 set_error()194#if not error_detected:195if True:196 method_name = "ldns_buffer.export()"197 sys.stderr.write("%s not tested.\n" % (method_name))198#if not error_detected:199if True:200 mehod_name = "ldns_buffer.flip()"201 buf.printf("abcdef")202 try:203 buf.flip()204 except:205 set_error()206# if buf.remaining() != capacity:207# # Should be at beginning.208# set_error()209 buf.clear()210#if not error_detected:211if True:212 method_name = "ldns_buffer.getc()"213 buf.printf("a")214 buf.rewind()215 try:216 ret = buf.getc()217 except:218 set_error()219 if ret != ord("a"):220 set_error()221# Test return value for -1222 buf.clear()223#if not error_detected:224if True:225 method_name = "ldns_buffer.invariant()"226 try:227 buf.invariant()228 except:229 set_error()230#if not error_detected:231if True:232 method_name = "ldns_buffer.limit()"233 try:234 ret = buf.limit()235 except:236 set_error()237 if ret != capacity:238 set_error()239#if not error_detected:240if True:241 method_name = "ldns_buffer.position()"242 try:243 ret = buf.position()244 except:245 set_error()246 if (not isinstance(ret, int)) and (not isinstance(ret, long)):247 set_error()248#if not error_detected:249if True:250 method_name = "ldns_buffer.printf()"251 try:252 ret = buf.printf("abcdef")253 except:254 set_error()255 if not isinstance(ret, int):256 set_error()257 try:258 ret = buf.printf(10)259 set_error()260 except TypeError:261 pass262 except:263 set_error()264 buf.clear()265#if not error_detected:266if True:267 method_name = "ldns_buffer.read()"268 sys.stderr.write("%s not tested.\n" % (method_name))269#if not error_detected:270if True:271 method_name = "ldns_buffer.read_at()"272 sys.stderr.write("%s not tested.\n" % (method_name))273#if not error_detected:274if True:275 method_name = "ldns_buffer.read_u16()"276 buf.printf("aac")277 buf.rewind()278 try:279 ret = buf.read_u16()280 except:281 set_error()282 if (not isinstance(ret, int)) and (not isinstance(ret, long)):283 set_error()284 if ret != (ord("a") * 0x0101):285 set_error()286 buf.clear()287#if not error_detected:288if True:289 method_name = "ldns_buffer.read_u16_at()"290 buf.printf("abbc")291 try:292 ret = buf.read_u16_at(1)293 except:294 set_error()295 if (not isinstance(ret, int)) and (not isinstance(ret, long)):296 set_error()297 if ret != (ord("b") * 0x0101):298 set_error()299 try:300 ret = buf.read_u16_at("")301 set_error()302 except TypeError:303 pass304 except:305 set_error()306# try:307# ret = buf.read_u16_at(-1)308# set_error()309# except ValueError:310# pass311# except:312# set_error()313 buf.clear()314#if not error_detected:315if True:316 method_name = "ldns_buffer.read_u32()"317 buf.printf("aaaac")318 buf.rewind()319 try:320 ret = buf.read_u32()321 except:322 set_error()323 if not isinstance(ret, int):324 set_error()325 if ret != (ord("a") * 0x01010101):326 set_error()327 buf.clear()328#if not error_detected:329if True:330 method_name = "ldns_buffer.read_u32_at()"331 buf.printf("abbbbc")332 try:333 ret = buf.read_u32_at(1)334 except:335 set_error()336 if not isinstance(ret, int):337 set_error()338 if ret != (ord("b") * 0x01010101):339 set_error()340 try:341 ret = buf.read_u32_at("")342 set_error()343 except TypeError:344 pass345 except:346 set_error()347# try:348# ret = buf.read_u32_at(-1)349# set_error()350# except ValueError:351# pass352# except:353# set_error()354 buf.clear()355#if not error_detected:356if True:357 method_name = "ldns_buffer.read_u8()"358 buf.printf("ac")359 buf.rewind()360 try:361 ret = buf.read_u8()362 except:363 set_error()364 if (not isinstance(ret, int)) and (not isinstance(ret, long)):365 set_error()366 if ret != ord("a"):367 set_error()368 buf.clear()369#if not error_detected:370if True:371 method_name = "ldns_buffer.read_u8_at()"372 buf.printf("abc")373 try:374 ret = buf.read_u8_at(1)375 except:376 set_error()377 if (not isinstance(ret, int)) and (not isinstance(ret, long)):378 set_error()379 if ret != ord("b"):380 set_error()381 try:382 ret = buf.read_u8_at("")383 set_error()384 except TypeError:385 pass386 except:387 set_error()388# try:389# ret = buf.read_u8_at(-1)390# set_error()391# except ValueError:392# pass393# except:394# set_error()395 buf.clear()396#if not error_detected:397if True:398 method_name = "ldns_buffer.remaining()"399 buf.printf("abcdef")400 try:401 ret = buf.remaining()402 except:403 set_error()404 if (not isinstance(ret, int)) and (not isinstance(ret, long)):405 set_error()406 if ret != (capacity - 6):407 set_error()408 buf.clear()409#if not error_detected:410if True:411 method_name = "ldns_buffer.remaining_at()"412 buf.printf("abcdef")413 try:414 ret = buf.remaining_at(1)415 except:416 set_error()417 if (not isinstance(ret, int)) and (not isinstance(ret, long)):418 set_error()419 if ret != (capacity - 1):420 set_error()421 try:422 ret = buf.remaining_at("")423 set_error()424 except TypeError:425 pass426 except:427 set_error()428# try:429# ret = buf.remaining_at(-1)430# set_error()431# except ValueError:432# pass433# except:434# set_error()435 buf.clear()436#if not error_detected:437if True:438 method_name = "ldns_buffer.reserve()"439 buf2 = ldns.ldns_buffer(512)440 try:441 ret = buf2.reserve(1024)442 except:443 set_error()444 if not isinstance(ret, bool):445 set_error()446 try:447 ret = buf2.reserve("")448 set_error()449 except TypeError:450 pass451 except:452 set_error()453# try:454# ret = buf2.reserve(-1)455# set_error()456# except ValueError:457# pass458# except:459# set_error()460#if not error_detected:461if True:462 method_name = "ldns_buffer.rewind()"463 buf.printf("abcdef")464 try:465 buf.rewind()466 except:467 set_error()468 if buf.position() != 0:469 set_error()470 buf.clear()471#if not error_detected:472if True:473 method_name = "ldns_buffer.set_capacity()"474 try:475 ret = buf.set_capacity(capacity)476 except:477 set_error()478 if not isinstance(ret, bool):479 set_error()480 try:481 ret = buf.set_capacity("")482 set_error()483 except TypeError:484 pass485 except:486 set_error()487# try:488# ret = buf.set_capacity(-1)489# set_error()490# except ValueError:491# pass492# except:493# set_error()494 buf.clear()495#if not error_detected:496if True:497 method_name = "ldns_buffer.set_limit()"498 try:499 buf.set_limit(0)500 except:501 set_error()502 try:503 buf.set_limit("")504 set_error()505 except TypeError:506 pass507 except:508 set_error()509# try:510# buf.set_limit(-1)511# set_error()512# except ValueError:513# pass514# except:515# set_error()516 buf.clear()517 518#if not error_detected:519if True:520 method_name = "ldns_buffer.set_position()"521 try:522 buf.set_position(0)523 except:524 set_error()525 try:526 buf.set_position("")527 except TypeError:528 pass529 except:530 set_error()531# try:532# buf.set_position(-1)533# except ValueError:534# pass535# except:536# set_error()537 buf.clear()538#if not error_detected:539if True:540 method_name = "ldns_buffer.skip()"541 try:542 buf.skip(10)543 except:544 set_error()545 try:546 buf.skip(-1)547 except:548 set_error()549 try:550 buf.skip("")551 set_error()552 except TypeError:553 pass554 except:555 set_error()556 buf.clear()557#if not error_detected:558if True:559 method_name = "ldns_buffer.status()"560 try:561 ret = buf.status()562 except:563 set_error()564 # Returned status is an integer.565 if not isinstance(ret, int):566 set_error()567 buf.clear()568#if not error_detected:569if True:570 method_name = "ldns_buffer.status_ok()"571 try:572 ret = buf.status_ok()573 except:574 set_error()575 if not isinstance(ret, bool):576 set_error()577 buf.clear()578#if not error_detected:579if True:580 method_name = "ldns_buffer.write()"581 sys.stderr.write("%s not tested.\n" % (method_name))582#if not error_detected:583if True:584 method_name = "ldns_buffer.write_at()"585 sys.stderr.write("%s not tested.\n" % (method_name))586#if not error_detected:587if True:588 method_name = "ldns_buffer.write_string()"589 try:590 buf.write_string("abcdef")591 except:592 set_error()593# try:594# buf.write_sring(-1)595# set_error()596# except TypeError:597# pass598# except:599# set_error()600 sys.stderr.write("%s not tested for parameter correctness.\n" % \601 (method_name))602 buf.clear()603#if not error_detected:604if True:605 method_name = "ldns_buffer.write_string_at()"606 sys.stderr.write("%s not tested.\n" % (method_name))607#if not error_detected:608if True:609 method_name = "ldns_buffer.write_u16()"610 try:611 buf.write_u16(ord("b") * 0x0101)612 except:613 set_error()614 try:615 buf.write_u16("")616 set_error()617 except TypeError:618 pass619 except:620 set_error()621 buf.clear()622#if not error_detected:623if True:624 method_name = "ldns_buffer.write_u16_at()"625 buf.printf("a")626 try:627 buf.write_u16_at(1, ord("b") * 0x0101)628 except:629 set_error()630 try:631 buf.write_u16_at("", ord("b") * 0x0101)632 set_error()633 except TypeError:634 pass635 except:636 set_error()637# try:638# buf.write_u16_at(-1, ord("b") * 0x0101)639# set_error()640# except ValueError:641# pass642# except:643# set_error()644 try:645 buf.write_u16_at(1, "")646 set_error()647 except TypeError:648 pass649 except:650 set_error()651#if not error_detected:652if True:653 method_name = "ldns_buffer.write_u32()"654 try:655 buf.write_u32(ord("b") * 0x01010101)656 except:657 set_error()658 try:659 buf.write_u32("")660 set_error()661 except TypeError:662 pass663 except:664 set_error()665 buf.clear()666#if not error_detected:667if True:668 method_name = "ldns_buffer.write_u32_at()"669 buf.printf("a")670 try:671 buf.write_u32_at(1, ord("b") * 0x01010101)672 except:673 set_error()674 try:675 buf.write_u32_at("", ord("b") * 0x01010101)676 set_error()677 except TypeError:678 pass679 except:680 set_error()681# try:682# buf.write_u32_at(-1, ord("b") * 0x01010101)683# set_error()684# except ValueError:685# pass686# except:687# set_error()688 try:689 buf.write_u32_at(1, "")690 set_error()691 except TypeError:692 pass693 except:694 set_error()695#if not error_detected:696if True:697 method_name = "ldns_buffer.write_u8()"698 try:699 buf.write_u8(ord("b"))700 except:701 set_error()702 try:703 buf.write_u8("")704 set_error()705 except TypeError:706 pass707 except:708 set_error()709 buf.clear()710#if not error_detected:711if True:712 method_name = "ldns_buffer.write_u8_at()"713 buf.printf("a")714 try:715 buf.write_u8_at(1, ord("b"))716 except:717 set_error()718 try:719 buf.write_u8_at("", ord("b"))720 set_error()721 except TypeError:722 pass723 except:724 set_error()725# try:726# buf.write_u8_at(-1, ord("b"))727# set_error()728# except ValueError:729# pass730# except:731# set_error()732 try:733 buf.write_u8_at(1, "")734 set_error()735 except TypeError:736 pass737 except:738 set_error()739if not error_detected:740 sys.stdout.write("%s: passed.\n" % (os.path.basename(__file__)))741else:742 sys.stdout.write("%s: errors detected.\n" % (os.path.basename(__file__)))...
test_dname.py
Source:test_dname.py
...12class_name = "ldns_dname"13method_name = None14error_detected = False15temp_fname = "tmp_dname.txt"16def set_error():17 """18 Writes an error message and sets error flag.19 """20 global class_name21 global method_name22 global error_detected23 error_detected = True24 sys.stderr.write("(line %d): malfunctioning method %s.\n" % \25 (inspect.currentframe().f_back.f_lineno, method_name))26#if not error_detected:27if True:28 method_name = class_name + ".__init__()"29 rdf1 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_DNAME, "test.nic.cz.")30 rdf2 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_A, "217.31.205.50")31 try:32 dname = ldns.ldns_dname("www.nic.cz.")33 if not isinstance(dname, ldns.ldns_dname):34 set_error()35 except:36 set_error()37 #38 # Error when printing a dname wich was created fron an empty string.39 # Must find out why.40 #41 try:42 dname = ldns.ldns_dname(rdf1)43 if not isinstance(dname, ldns.ldns_dname):44 set_error()45 except:46 set_error()47 # Test whether rdf1 and dname independent.48 dname.cat(dname)49 if dname.__str__() == rdf1.__str__():50 set_error()51 # Test whether rdf1 and dname are dependent.52 dname = ldns.ldns_dname(rdf1, clone=False)53 dname.cat(dname)54 if dname.__str__() != rdf1.__str__():55 set_error()56 # Test whether constructs from non-dname rdfs.57 try:58 dname = ldns.ldns_dname(rdf2)59 set_error()60 except TypeError:61 pass62 except:63 set_error()64 try:65 dname = ldns.ldns_dname(1)66 set_error()67 except TypeError:68 pass69 except:70 set_error()71#if not error_detected:72if True:73 method_name = class_name + ".[comparison operators]"74 dn1 = ldns.ldns_dname("a.test")75 dn2 = ldns.ldns_dname("b.test")76 try:77 ret = dn1 < dn278 if not isinstance(ret, bool):79 set_error()80 if ret != True:81 set_error()82 except:83 set_error()84 try:85 ret = dn2 < dn186 if not isinstance(ret, bool):87 set_error()88 if ret != False:89 set_error()90 except:91 set_error()92 try:93 ret = dn1 <= dn294 if not isinstance(ret, bool):95 set_error()96 if ret != True:97 set_error()98 except:99 set_error()100 try:101 ret = dn2 <= dn1102 if not isinstance(ret, bool):103 set_error()104 if ret != False:105 set_error()106 except:107 set_error()108 try:109 ret = dn1 == dn2110 if not isinstance(ret, bool):111 set_error()112 if ret != False:113 set_error()114 except:115 set_error()116 try:117 ret = dn1 == dn1118 if not isinstance(ret, bool):119 set_error()120 if ret != True:121 set_error()122 except:123 set_error()124 try:125 ret = dn1 != dn2126 if not isinstance(ret, bool):127 set_error()128 if ret != True:129 set_error()130 except:131 set_error()132 try:133 ret = dn1 != dn1134 if not isinstance(ret, bool):135 set_error()136 if ret != False:137 set_error()138 except:139 set_error()140 try:141 ret = dn1 > dn2142 if not isinstance(ret, bool):143 set_error()144 if ret != False:145 set_error()146 except:147 set_error()148 try:149 ret = dn2 > dn1150 if not isinstance(ret, bool):151 set_error()152 if ret != True:153 set_error()154 except:155 set_error()156 try:157 ret = dn1 >= dn2158 if not isinstance(ret, bool):159 set_error()160 if ret != False:161 set_error()162 except:163 set_error()164 try:165 ret = dn2 >= dn1166 if not isinstance(ret, bool):167 set_error()168 if ret != True:169 set_error()170 except:171 set_error()172#if not error_detected:173if True:174 method_name = class_name + ".absolute()"175 dname = ldns.ldns_dname("www.nic.cz.")176 try:177 ret = dname.absolute()178 if not isinstance(ret, bool):179 set_error()180 if ret != True:181 set_error()182 except:183 set_error()184#if not error_detected:185if True:186 method_name = class_name + ".cat()"187 rdf1 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_DNAME, "test.nic.cz.")188 rdf2 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_A, "217.31.205.50")189 dname = ldns.ldns_dname("www.nic.cz.")190 try:191 ret = dname.cat(dname)192 if ret != ldns.LDNS_STATUS_OK:193 set_error()194 if dname.__str__() != "www.nic.cz.www.nic.cz.":195 set_error()196 except:197 set_error()198 try:199 ret = dname.cat(rdf1)200 if ret != ldns.LDNS_STATUS_OK:201 set_error()202 if dname.__str__() != "www.nic.cz.www.nic.cz.test.nic.cz.":203 set_error()204 except:205 set_error()206 try:207 ret = dname.cat(rdf2)208 if ret == ldns.LDNS_STATUS_OK:209 set_error()210 except:211 set_error()212 try:213 ret = dname.cat("")214 set_error()215 except TypeError:216 pass217 except:218 set_error()219#if not error_detected:220if True:221 method_name = class_name + ".cat_clone()"222 rdf1 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_DNAME, "test.nic.cz.")223 rdf2 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_A, "217.31.205.50")224 dname = ldns.ldns_dname("www.nic.cz.")225 try:226 ret = dname.cat_clone(dname)227 if not isinstance(ret, ldns.ldns_dname):228 set_error()229 if ret.__str__() != "www.nic.cz.www.nic.cz.":230 set_error()231 except:232 set_error()233 try:234 ret = dname.cat_clone(rdf1)235 if not isinstance(ret, ldns.ldns_dname):236 set_error()237 if ret.__str__() != "www.nic.cz.test.nic.cz.":238 set_error()239 except:240 set_error()241 try:242 ret = dname.cat_clone(rdf2)243 if ret != None:244 set_error()245 except:246 set_error()247 try:248 ret = dname.cat_clone("")249 except TypeError:250 pass251 except:252 set_error()253#if not error_detected:254if True:255 method_name = class_name + ".interval()"256 dn1 = ldns.ldns_dname("a.ns.nic.cz.")257 dn2 = ldns.ldns_dname("b.ns.nic.cz.")258 dn3 = ldns.ldns_dname("c.ns.nic.cz.")259 try:260 ret = dn1.interval(dn2, dn3)261 if ret != -1:262 set_error()263 except:264 set_error()265 try:266 ret = dn2.interval(dn1, dn3)267 if ret != 1:268 set_error()269 except:270 set_error()271 rdf4 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_DNAME, "d.ns.nic.cz.")272 rdf5 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_A, "194.0.12.1")273 try:274 ret = dn1.interval(dn2, rdf4)275 if ret != -1:276 set_error()277 except:278 set_error()279 try:280 ret = dn2.interval(dn1, rdf4)281 if ret != 1:282 set_error()283 except:284 set_error()285 try:286 ret = dn1.interval(dn2, rdf5)287 set_error()288 except Exception:289 pass290 except:291 set_error()292 try:293 ret = dn1.interval(dn2, "")294 set_error()295 except TypeError:296 pass297 except:298 set_error()299#if not error_detected:300if True:301 method_name = class_name + ".is_subdomain()"302 dn1 = ldns.ldns_dname("nic.cz.")303 dn2 = ldns.ldns_dname("www.nic.cz.")304 rdf3 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_DNAME, "www.nic.cz.")305 try:306 ret = dn1.is_subdomain(dn2)307 if not isinstance(ret, bool):308 set_error()309 if ret == True:310 set_error()311 ret = dn2.is_subdomain(dn1)312 if ret != True:313 set_error()314 except:315 set_error()316 try:317 ret = dn1.is_subdomain(rdf3)318 if not isinstance(ret, bool):319 set_error()320 if ret == True:321 set_error()322 except:323 set_error()324 rdf4 = ldns.ldns_rdf_new_frm_str(ldns.LDNS_RDF_TYPE_A, "194.0.12.1")325 try:326 ret = dn1.is_subdomain(rdf4)327 if ret != False:328 set_error()329 except:330 set_error()331 try:332 ret = dn1.is_subdomain("")333 set_error()334 except TypeError:335 pass336 except:337 set_error()338#if not error_detected:339if True:340 method_name = class_name + ".label()"341 dn = ldns.ldns_dname("nic.cz.")342 try:343 ret = dn.label(0)344 if not isinstance(ret, ldns.ldns_dname):345 set_error()346 except:347 set_error()348 try:349 ret = dn.label(10)350 if ret != None:351 set_error()352 except:353 set_error()354 try:355 ret = dn.label("")356 except TypeError:357 pass358 except:359 set_error()360#if not error_detected:361if True:362 method_name = class_name + ".label_count()"363 dn = ldns.ldns_dname("www.nic.cz.")364 try:365 ret = dn.label_count()366 if (not isinstance(ret, int)) and (not isinstance(ret, long)):367 set_error()368 if ret != 3:369 set_error()370 except:371 set_error()372#if not error_detected:373if True:374 method_name = class_name + ".left_chop()"375 dn = ldns.ldns_dname("www.nic.cz.")376 try:377 ret = dn.left_chop()378 if not isinstance(ret, ldns.ldns_dname):379 set_error()380 except:381 set_error()382#if not error_detected:383if True:384 method_name = class_name + ".make_canonical()"385 dn = ldns.ldns_dname("WWW.NIC.CZ.")386 try:387 dn.make_canonical()388 if dn.__str__() != "www.nic.cz.":389 set_error()390 except:391 set_error()392#if not error_detected:393if True:394 method_name = class_name + ".new_frm_rdf()"395 # Tested via constructor call.396#if not error_detected:397if True:398 method_name = class_name + ".new_frm_str()"399 # Tested via constructor call.400#if not error_detected:401if True:402 method_name = class_name + ".reverse()"403 dn = ldns.ldns_dname("www.nic.cz.")404 try:405 ret = dn.reverse()406 if not isinstance(ret, ldns.ldns_dname):407 set_error()408 if ret.__str__() != "cz.nic.www.":409 set_error()410 except:411 set_error()412#if not error_detected:413if True:414 method_name = class_name + ".write_to_buffer()"415 dn = ldns.ldns_dname("www.nic.cz.")416 buf = ldns.ldns_buffer(1024)417 try:418 ret = dn.write_to_buffer(buf)419 if ret != ldns.LDNS_STATUS_OK:420 set_error()421 if buf.position() != 12:422 set_error()423 except:424 set_error()425 try:426 ret = dn.write_to_buffer("")427 except TypeError:428 pass429 except:430 set_error()431if not error_detected:432 sys.stdout.write("%s: passed.\n" % (os.path.basename(__file__)))433else:434 sys.stdout.write("%s: errors detected.\n" % (os.path.basename(__file__)))...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!