Before

…lines 1–28 unchanged (28 lines)
29 with (
30 self.subTest(template_name=template_name),
31 self.assertRaisesMessage(TemplateDoesNotExist, str(template_name)),
32 ):
33 engine.get_template(template_name)
34
35 def test_template_source_is_correct(self):
36 partial = engine.get_template("partial_examples.html#test-partial")
37 msg = (
38 "PartialTemplate.source is only available when "
39 "template debugging is enabled."
40 )
41 with self.assertRaisesMessage(RuntimeWarning, msg):
42 self.assertEqual(
43 partial.template.source,
44 "{% partialdef test-partial %}\n"
45 "TEST-PARTIAL-CONTENT\n"
46 "{% endpartialdef %}",
47 )
48
49 def test_template_source_inline_is_correct(self):
50 partial = engine.get_template("partial_examples.html#inline-partial")
51 msg = (
52 "PartialTemplate.source is only available when "
53 "template debugging is enabled."
54 )
55 with self.assertRaisesMessage(RuntimeWarning, msg):
56 self.assertEqual(
57 partial.template.source,
58 "{% partialdef inline-partial inline %}\nINLINE-CONTENT\n"
59 "{% endpartialdef %}",
60 )
61
62 def test_full_template_from_loader(self):
63 template = engine.get_template("partial_examples.html")
64 rendered = template.render({})
65
66 # Check the partial was rendered twice
…lines 67–169 unchanged (103 lines)
170 with self.assertWarnsMessage(
171 RuntimeWarning,
172 "PartialTemplate.source is only available when template "
173 "debugging is enabled.",
174 ):
175 self.assertEqual(
176 partial.template.source,
177 "{% partialdef test-partial %}\n"
178 "TEST-PARTIAL-CONTENT\n"
179 "{% endpartialdef %}",
180 )
181
182
183class RobustPartialHandlingTests(TestCase):
184
185 def override_get_template(self, **kwargs):
186 class TemplateWithCustomAttrs:
…lines 187–282 unchanged (96 lines)
283 partial_proxy = template.extra_data["partials"]["inline-partial"]
284
285 expected = """{% partialdef inline-partial inline %}
286INLINE-CONTENT
287{% endpartialdef %}"""
288 self.assertEqual(partial_proxy.source.strip(), expected.strip())
289
290 @setup(
291 {
292 "empty_partial_template": ("{% partialdef empty %}{% endpartialdef %}"),
293 },
294 debug_only=True,
295 )
296 def test_find_partial_source_empty_partial(self):
297 template = self.engine.get_template("empty_partial_template")
298 partial_proxy = template.extra_data["partials"]["empty"]
299
300 result = partial_proxy.find_partial_source(template.source, "empty")
301 self.assertEqual(result, "{% partialdef empty %}{% endpartialdef %}")
302
303 @setup(
304 {
305 "consecutive_partials_template": (
306 "{% partialdef empty %}{% endpartialdef %}"
…lines 307–311 unchanged (5 lines)
312 def test_find_partial_source_multiple_consecutive_partials(self):
313 template = self.engine.get_template("consecutive_partials_template")
314
315 empty_proxy = template.extra_data["partials"]["empty"]
316 other_proxy = template.extra_data["partials"]["other"]
317
318 empty_result = empty_proxy.find_partial_source(template.source, "empty")
319 self.assertEqual(empty_result, "{% partialdef empty %}{% endpartialdef %}")
320
321 other_result = other_proxy.find_partial_source(template.source, "other")
322 self.assertEqual(other_result, "{% partialdef other %}...{% endpartialdef %}")
323
324 def test_partials_with_duplicate_names(self):
325 test_cases = [
326 (
327 "nested",
…lines 328–364 unchanged (37 lines)
365 debug_only=True,
366 )
367 def test_find_partial_source_supports_named_end_tag(self):
368 template = self.engine.get_template("named_end_tag_template")
369 partial_proxy = template.extra_data["partials"]["thing"]
370
371 result = partial_proxy.find_partial_source(template.source, "thing")
372 self.assertEqual(
373 result, "{% partialdef thing %}CONTENT{% endpartialdef thing %}"
374 )
375
376 @setup(
377 {
…lines 378–385 unchanged (8 lines)
386 def test_find_partial_source_supports_nested_partials(self):
387 template = self.engine.get_template("nested_partials_basic_template")
388
389 empty_proxy = template.extra_data["partials"]["outer"]
390 other_proxy = template.extra_data["partials"]["inner"]
391
392 outer_result = empty_proxy.find_partial_source(template.source, "outer")
393 self.assertEqual(
394 outer_result,
395 (
396 "{% partialdef outer %}{% partialdef inner %}"
397 "...{% endpartialdef %}{% endpartialdef %}"
398 ),
399 )
400
401 inner_result = other_proxy.find_partial_source(template.source, "inner")
402 self.assertEqual(inner_result, "{% partialdef inner %}...{% endpartialdef %}")
403
404 @setup(
405 {
406 "nested_partials_named_end_template": (
407 "{% partialdef outer %}"
…lines 408–413 unchanged (6 lines)
414 def test_find_partial_source_supports_nested_partials_and_named_end_tags(self):
415 template = self.engine.get_template("nested_partials_named_end_template")
416
417 empty_proxy = template.extra_data["partials"]["outer"]
418 other_proxy = template.extra_data["partials"]["inner"]
419
420 outer_result = empty_proxy.find_partial_source(template.source, "outer")
421 self.assertEqual(
422 outer_result,
423 (
424 "{% partialdef outer %}{% partialdef inner %}"
425 "...{% endpartialdef inner %}{% endpartialdef outer %}"
426 ),
427 )
428
429 inner_result = other_proxy.find_partial_source(template.source, "inner")
430 self.assertEqual(
431 inner_result, "{% partialdef inner %}...{% endpartialdef inner %}"
432 )
433
434 @setup(
435 {
…lines 436–443 unchanged (8 lines)
444 def test_find_partial_source_supports_nested_partials_and_mixed_end_tags_1(self):
445 template = self.engine.get_template("nested_partials_mixed_end_1_template")
446
447 empty_proxy = template.extra_data["partials"]["outer"]
448 other_proxy = template.extra_data["partials"]["inner"]
449
450 outer_result = empty_proxy.find_partial_source(template.source, "outer")
451 self.assertEqual(
452 outer_result,
453 (
454 "{% partialdef outer %}{% partialdef inner %}"
455 "...{% endpartialdef %}{% endpartialdef outer %}"
456 ),
457 )
458
459 inner_result = other_proxy.find_partial_source(template.source, "inner")
460 self.assertEqual(inner_result, "{% partialdef inner %}...{% endpartialdef %}")
461
462 @setup(
463 {
464 "nested_partials_mixed_end_2_template": (
465 "{% partialdef outer %}"
…lines 466–471 unchanged (6 lines)
472 def test_find_partial_source_supports_nested_partials_and_mixed_end_tags_2(self):
473 template = self.engine.get_template("nested_partials_mixed_end_2_template")
474
475 empty_proxy = template.extra_data["partials"]["outer"]
476 other_proxy = template.extra_data["partials"]["inner"]
477
478 outer_result = empty_proxy.find_partial_source(template.source, "outer")
479 self.assertEqual(
480 outer_result,
481 (
482 "{% partialdef outer %}{% partialdef inner %}"
483 "...{% endpartialdef inner %}{% endpartialdef %}"
484 ),
485 )
486
487 inner_result = other_proxy.find_partial_source(template.source, "inner")
488 self.assertEqual(
489 inner_result, "{% partialdef inner %}...{% endpartialdef inner %}"
490 )
491

After

…lines 1–27 unchanged (27 lines)
28 for template_name in [123, None, "", "#", "#name"]:
29 with (
30 self.subTest(template_name=template_name),
31 self.assertRaisesMessage(TemplateDoesNotExist, str(template_name)),
32 ):
33 engine.get_template(template_name)
34
35 def test_full_template_from_loader(self):
36 template = engine.get_template("partial_examples.html")
37 rendered = template.render({})
38
39 # Check the partial was rendered twice
40 self.assertEqual(2, rendered.count("TEST-PARTIAL-CONTENT"))
…lines 41–141 unchanged (101 lines)
142 partial = engine.get_template("partial_examples.html#test-partial")
143 with self.assertWarnsMessage(
144 RuntimeWarning,
145 "PartialTemplate.source is only available when template "
146 "debugging is enabled.",
147 ):
148 self.assertEqual(partial.template.source, "")
149
150
151class RobustPartialHandlingTests(TestCase):
152
153 def override_get_template(self, **kwargs):
154 class TemplateWithCustomAttrs:
…lines 155–251 unchanged (97 lines)
252
253 expected = """{% partialdef inline-partial inline %}
254INLINE-CONTENT
255{% endpartialdef %}"""
256 self.assertEqual(partial_proxy.source.strip(), expected.strip())
257
258 def test_find_partial_source_fallback_cases(self):
259 cases = {"None offsets": (None, None), "Out of bounds offsets": (10, 20)}
260 for name, (source_start, source_end) in cases.items():
261 with self.subTest(name):
262 partial = PartialTemplate(
263 NodeList(),
264 Origin("test"),
265 "test",
266 source_start=source_start,
267 source_end=source_end,
268 )
269 result = partial.find_partial_source("nonexistent-partial")
270 self.assertEqual(result, "")
271
272 @setup(
273 {
274 "empty_partial_template": ("{% partialdef empty %}{% endpartialdef %}"),
275 },
276 debug_only=True,
277 )
278 def test_find_partial_source_empty_partial(self):
279 template = self.engine.get_template("empty_partial_template")
280 partial_proxy = template.extra_data["partials"]["empty"]
281
282 result = partial_proxy.find_partial_source(template.source)
283 self.assertEqual(result, "{% partialdef empty %}{% endpartialdef %}")
284
285 @setup(
286 {
287 "consecutive_partials_template": (
288 "{% partialdef empty %}{% endpartialdef %}"
…lines 289–293 unchanged (5 lines)
294 def test_find_partial_source_multiple_consecutive_partials(self):
295 template = self.engine.get_template("consecutive_partials_template")
296
297 empty_proxy = template.extra_data["partials"]["empty"]
298 other_proxy = template.extra_data["partials"]["other"]
299
300 empty_result = empty_proxy.find_partial_source(template.source)
301 self.assertEqual(empty_result, "{% partialdef empty %}{% endpartialdef %}")
302
303 other_result = other_proxy.find_partial_source(template.source)
304 self.assertEqual(other_result, "{% partialdef other %}...{% endpartialdef %}")
305
306 def test_partials_with_duplicate_names(self):
307 test_cases = [
308 (
309 "nested",
…lines 310–346 unchanged (37 lines)
347 debug_only=True,
348 )
349 def test_find_partial_source_supports_named_end_tag(self):
350 template = self.engine.get_template("named_end_tag_template")
351 partial_proxy = template.extra_data["partials"]["thing"]
352
353 result = partial_proxy.find_partial_source(template.source)
354 self.assertEqual(
355 result, "{% partialdef thing %}CONTENT{% endpartialdef thing %}"
356 )
357
358 @setup(
359 {
…lines 360–367 unchanged (8 lines)
368 def test_find_partial_source_supports_nested_partials(self):
369 template = self.engine.get_template("nested_partials_basic_template")
370
371 empty_proxy = template.extra_data["partials"]["outer"]
372 other_proxy = template.extra_data["partials"]["inner"]
373
374 outer_result = empty_proxy.find_partial_source(template.source)
375 self.assertEqual(
376 outer_result,
377 (
378 "{% partialdef outer %}{% partialdef inner %}"
379 "...{% endpartialdef %}{% endpartialdef %}"
380 ),
381 )
382
383 inner_result = other_proxy.find_partial_source(template.source)
384 self.assertEqual(inner_result, "{% partialdef inner %}...{% endpartialdef %}")
385
386 @setup(
387 {
388 "nested_partials_named_end_template": (
389 "{% partialdef outer %}"
…lines 390–395 unchanged (6 lines)
396 def test_find_partial_source_supports_nested_partials_and_named_end_tags(self):
397 template = self.engine.get_template("nested_partials_named_end_template")
398
399 empty_proxy = template.extra_data["partials"]["outer"]
400 other_proxy = template.extra_data["partials"]["inner"]
401
402 outer_result = empty_proxy.find_partial_source(template.source)
403 self.assertEqual(
404 outer_result,
405 (
406 "{% partialdef outer %}{% partialdef inner %}"
407 "...{% endpartialdef inner %}{% endpartialdef outer %}"
408 ),
409 )
410
411 inner_result = other_proxy.find_partial_source(template.source)
412 self.assertEqual(
413 inner_result, "{% partialdef inner %}...{% endpartialdef inner %}"
414 )
415
416 @setup(
417 {
…lines 418–425 unchanged (8 lines)
426 def test_find_partial_source_supports_nested_partials_and_mixed_end_tags_1(self):
427 template = self.engine.get_template("nested_partials_mixed_end_1_template")
428
429 empty_proxy = template.extra_data["partials"]["outer"]
430 other_proxy = template.extra_data["partials"]["inner"]
431
432 outer_result = empty_proxy.find_partial_source(template.source)
433 self.assertEqual(
434 outer_result,
435 (
436 "{% partialdef outer %}{% partialdef inner %}"
437 "...{% endpartialdef %}{% endpartialdef outer %}"
438 ),
439 )
440
441 inner_result = other_proxy.find_partial_source(template.source)
442 self.assertEqual(inner_result, "{% partialdef inner %}...{% endpartialdef %}")
443
444 @setup(
445 {
446 "nested_partials_mixed_end_2_template": (
447 "{% partialdef outer %}"
…lines 448–453 unchanged (6 lines)
454 def test_find_partial_source_supports_nested_partials_and_mixed_end_tags_2(self):
455 template = self.engine.get_template("nested_partials_mixed_end_2_template")
456
457 empty_proxy = template.extra_data["partials"]["outer"]
458 other_proxy = template.extra_data["partials"]["inner"]
459
460 outer_result = empty_proxy.find_partial_source(template.source)
461 self.assertEqual(
462 outer_result,
463 (
464 "{% partialdef outer %}{% partialdef inner %}"
465 "...{% endpartialdef inner %}{% endpartialdef %}"
466 ),
467 )
468
469 inner_result = other_proxy.find_partial_source(template.source)
470 self.assertEqual(
471 inner_result, "{% partialdef inner %}...{% endpartialdef inner %}"
472 )
473
474 @setup(
475 {
476 "partial_embedded_in_verbatim": (
477 "{% verbatim %}\n"
478 "{% partialdef testing-name %}\n"
479 "<p>Should be ignored</p>"
480 "{% endpartialdef testing-name %}\n"
481 "{% endverbatim %}\n"
482 "{% partialdef testing-name %}\n"
483 "<p>Content</p>\n"
484 "{% endpartialdef %}\n"
485 ),
486 },
487 debug_only=True,
488 )
489 def test_partial_template_embedded_in_verbatim(self):
490 template = self.engine.get_template("partial_embedded_in_verbatim")
491 partial_template = template.extra_data["partials"]["testing-name"]
492 self.assertEqual(
493 partial_template.source,
494 "{% partialdef testing-name %}\n<p>Content</p>\n{% endpartialdef %}",
495 )
496
497 @setup(
498 {
499 "partial_debug_source": (
500 "{% partialdef testing-name %}\n"
501 "<p>Content</p>\n"
502 "{% endpartialdef %}\n"
503 ),
504 },
505 debug_only=True,
506 )
507 def test_partial_source_uses_offsets_in_debug(self):
508 template = self.engine.get_template("partial_debug_source")
509 partial_template = template.extra_data["partials"]["testing-name"]
510
511 self.assertEqual(partial_template._source_start, 0)
512 self.assertEqual(partial_template._source_end, 64)
513 expected = template.source[
514 partial_template._source_start : partial_template._source_end
515 ]
516 self.assertEqual(partial_template.source, expected)
517
518 @setup(
519 {
520 "partial_embedded_in_named_verbatim": (
521 "{% verbatim block1 %}\n"
522 "{% partialdef testing-name %}\n"
523 "{% endverbatim block1 %}\n"
524 "{% partialdef testing-name %}\n"
525 "<p>Named Content</p>\n"
526 "{% endpartialdef %}\n"
527 ),
528 },
529 debug_only=True,
530 )
531 def test_partial_template_embedded_in_named_verbatim(self):
532 template = self.engine.get_template("partial_embedded_in_named_verbatim")
533 partial_template = template.extra_data["partials"]["testing-name"]
534 self.assertEqual(
535 "{% partialdef testing-name %}\n<p>Named Content</p>\n{% endpartialdef %}",
536 partial_template.source,
537 )
538
539 @setup(
540 {
541 "partial_embedded_in_comment_block": (
542 "{% comment %}\n"
543 "{% partialdef testing-name %}\n"
544 "{% endcomment %}\n"
545 "{% partialdef testing-name %}\n"
546 "<p>Comment Content</p>\n"
547 "{% endpartialdef %}\n"
548 ),
549 },
550 debug_only=True,
551 )
552 def test_partial_template_embedded_in_comment_block(self):
553 template = self.engine.get_template("partial_embedded_in_comment_block")
554 partial_template = template.extra_data["partials"]["testing-name"]
555 self.assertEqual(
556 partial_template.source,
557 "{% partialdef testing-name %}\n"
558 "<p>Comment Content</p>\n"
559 "{% endpartialdef %}",
560 )
561
562 @setup(
563 {
564 "partial_embedded_in_inline_comment": (
565 "{# {% partialdef testing-name %} #}\n"
566 "{% partialdef testing-name %}\n"
567 "<p>Inline Comment Content</p>\n"
568 "{% endpartialdef %}\n"
569 ),
570 },
571 debug_only=True,
572 )
573 def test_partial_template_embedded_in_inline_comment(self):
574 template = self.engine.get_template("partial_embedded_in_inline_comment")
575 partial_template = template.extra_data["partials"]["testing-name"]
576 self.assertEqual(
577 partial_template.source,
578 "{% partialdef testing-name %}\n"
579 "<p>Inline Comment Content</p>\n"
580 "{% endpartialdef %}",
581 )
582
583 @setup(
584 {
585 "partial_contains_fake_end_inside_verbatim": (
586 "{% partialdef testing-name %}\n"
587 "{% verbatim %}{% endpartialdef %}{% endverbatim %}\n"
588 "<p>Body</p>\n"
589 "{% endpartialdef %}\n"
590 ),
591 },
592 debug_only=True,
593 )
594 def test_partial_template_contains_fake_end_inside_verbatim(self):
595 template = self.engine.get_template("partial_contains_fake_end_inside_verbatim")
596 partial_template = template.extra_data["partials"]["testing-name"]
597 self.assertEqual(
598 partial_template.source,
599 "{% partialdef testing-name %}\n"
600 "{% verbatim %}{% endpartialdef %}{% endverbatim %}\n"
601 "<p>Body</p>\n"
602 "{% endpartialdef %}",
603 )
604

Before

module
import_statement
import "import"
dotted_name
identifier "os"
import_from_statement
from "from"
dotted_name
identifier "unittest"
import "import"
dotted_name
identifier "mock"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "http"
import "import"
dotted_name
identifier "HttpResponse"
import_from_statement (+33 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "template"
. "."
identifier "backends"
. "."
identifier "django"
import "import"
dotted_name
identifier "DjangoTemplates"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "template"
. "."
identifier "loader"
import "import"
dotted_name
identifier "render_to_string"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "test"
import "import"
dotted_name
identifier "TestCase"
, ","
dotted_name
identifier "override_settings"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "urls"
import "import"
dotted_name
identifier "path"
, ","
dotted_name
identifier "reverse"
import_from_statement
from "from"
relative_import
import_prefix
. "."
dotted_name
identifier "utils"
import "import"
dotted_name
identifier "setup"
expression_statement
assignment
identifier "engine"
= "="
subscript
identifier "engines"
[ "["
string
string_start "\""
string_content "django"
string_end "\""
] "]"
class_definition
class "class"
identifier "PartialTagsTests"
argument_list
( "("
identifier "TestCase"
) ")"
: ":"
block
function_definition (+84 nodes collapsed)
function_definition
def "def"
identifier "test_template_source_is_correct"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "partial"
= "="
call
attribute
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_examples.html#test-partial"
string_end "\""
) ")"
expression_statement
assignment
identifier "msg"
= "="
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content "PartialTemplate.source is only available when "
string_end "\""
string
string_start "\""
string_content "template debugging is enabled."
string_end "\""
) ")"
with_statement
with "with"
with_clause
with_item
call
attribute
identifier "self"
. "."
identifier "assertRaisesMessage"
argument_list
( "("
identifier "RuntimeWarning"
, ","
identifier "msg"
) ")"
: ":"
block
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
attribute
identifier "partial"
. "."
identifier "template"
. "."
identifier "source"
, ","
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "{% endpartialdef %}"
string_end "\""
, ","
) ")"
function_definition
def "def"
identifier "test_template_source_inline_is_correct"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "partial"
= "="
call
attribute
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_examples.html#inline-partial"
string_end "\""
) ")"
expression_statement
assignment
identifier "msg"
= "="
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content "PartialTemplate.source is only available when "
string_end "\""
string
string_start "\""
string_content "template debugging is enabled."
string_end "\""
) ")"
with_statement
with "with"
with_clause
with_item
call
attribute
identifier "self"
. "."
identifier "assertRaisesMessage"
argument_list
( "("
identifier "RuntimeWarning"
, ","
identifier "msg"
) ")"
: ":"
block
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
attribute
identifier "partial"
. "."
identifier "template"
. "."
identifier "source"
, ","
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "{% endpartialdef %}"
string_end "\""
, ","
) ")"
function_definition (+87 nodes collapsed)
function_definition (+102 nodes collapsed)
function_definition (+280 nodes collapsed)
function_definition (+162 nodes collapsed)
function_definition (+215 nodes collapsed)
function_definition (+83 nodes collapsed)
function_definition
def "def"
identifier "test_template_source_warning"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "partial"
= "="
call
attribute
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_examples.html#test-partial"
string_end "\""
) ")"
with_statement
with "with"
with_clause (+22 nodes collapsed)
: ":"
block
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
attribute
identifier "partial"
. "."
identifier "template"
. "."
identifier "source"
, ","
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "{% endpartialdef %}"
string_end "\""
, ","
) ")"
class_definition (+501 nodes collapsed)
class_definition
class "class"
identifier "FindPartialSourceTests"
argument_list
( "("
identifier "TestCase"
) ")"
: ":"
block
decorated_definition (+130 nodes collapsed)
decorated_definition (+130 nodes collapsed)
decorated_definition
decorator (+30 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_empty_partial"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "empty_partial_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "result"
= "="
call
attribute
identifier "partial_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "empty"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "result"
, ","
string
string_start "\""
string_content "{% partialdef empty %}{% endpartialdef %}"
string_end "\""
) ")"
decorated_definition
decorator (+35 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_multiple_consecutive_partials"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "consecutive_partials_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "empty_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "empty"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "empty_result"
, ","
string
string_start "\""
string_content "{% partialdef empty %}{% endpartialdef %}"
string_end "\""
) ")"
expression_statement
assignment
identifier "other_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "other"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "other_result"
, ","
string
string_start "\""
string_content "{% partialdef other %}...{% endpartialdef %}"
string_end "\""
) ")"
function_definition (+121 nodes collapsed)
decorated_definition
decorator (+30 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_named_end_tag"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "named_end_tag_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "result"
= "="
call
attribute
identifier "partial_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "thing"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "result"
, ","
string
string_start "\""
string_content "{% partialdef thing %}CONTENT{% endpartialdef thing %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_basic_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "outer"
string_end "\""
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "inner"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials_and_named_"...
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_named_end_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "outer"
string_end "\""
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "inner"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef inner %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials_and_mixed_"...
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_mixed_end_1_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "outer"
string_end "\""
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "inner"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials_and_mixed_"...
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_mixed_end_2_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "outer"
string_end "\""
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content "inner"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef inner %}"
string_end "\""
) ")"

After

module
import_statement
import "import"
dotted_name
identifier "os"
import_from_statement
from "from"
dotted_name
identifier "unittest"
import "import"
dotted_name
identifier "mock"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "http"
import "import"
dotted_name
identifier "HttpResponse"
import_from_statement (+33 nodes collapsed)
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "template"
. "."
identifier "backends"
. "."
identifier "django"
import "import"
dotted_name
identifier "DjangoTemplates"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "template"
. "."
identifier "loader"
import "import"
dotted_name
identifier "render_to_string"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "test"
import "import"
dotted_name
identifier "TestCase"
, ","
dotted_name
identifier "override_settings"
import_from_statement
from "from"
dotted_name
identifier "django"
. "."
identifier "urls"
import "import"
dotted_name
identifier "path"
, ","
dotted_name
identifier "reverse"
import_from_statement
from "from"
relative_import
import_prefix
. "."
dotted_name
identifier "utils"
import "import"
dotted_name
identifier "setup"
expression_statement
assignment
identifier "engine"
= "="
subscript
identifier "engines"
[ "["
string
string_start "\""
string_content "django"
string_end "\""
] "]"
class_definition
class "class"
identifier "PartialTagsTests"
argument_list
( "("
identifier "TestCase"
) ")"
: ":"
block
function_definition (+84 nodes collapsed)
function_definition (+87 nodes collapsed)
function_definition (+102 nodes collapsed)
function_definition (+280 nodes collapsed)
function_definition (+162 nodes collapsed)
function_definition (+215 nodes collapsed)
function_definition (+83 nodes collapsed)
function_definition
def "def"
identifier "test_template_source_warning"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "partial"
= "="
call
attribute
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_examples.html#test-partial"
string_end "\""
) ")"
with_statement
with "with"
with_clause (+22 nodes collapsed)
: ":"
block
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
attribute
identifier "partial"
. "."
identifier "template"
. "."
identifier "source"
, ","
string
string_start "\""
string_end "\""
) ")"
class_definition (+501 nodes collapsed)
class_definition
class "class"
identifier "FindPartialSourceTests"
argument_list
( "("
identifier "TestCase"
) ")"
: ":"
block
decorated_definition (+130 nodes collapsed)
decorated_definition (+130 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_fallback_cases"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "cases"
= "="
dictionary
{ "{"
pair
string
string_start "\""
string_content "None offsets"
string_end "\""
: ":"
tuple
( "("
none "None"
, ","
none "None"
) ")"
, ","
pair
string
string_start "\""
string_content "Out of bounds offsets"
string_end "\""
: ":"
tuple
( "("
integer "10"
, ","
integer "20"
) ")"
} "}"
for_statement
for "for"
pattern_list
identifier "name"
, ","
tuple_pattern
( "("
identifier "source_start"
, ","
identifier "source_end"
) ")"
in "in"
call
attribute
identifier "cases"
. "."
identifier "items"
argument_list
( "("
) ")"
: ":"
block
with_statement
with "with"
with_clause
with_item
call
attribute
identifier "self"
. "."
identifier "subTest"
argument_list
( "("
identifier "name"
) ")"
: ":"
block
expression_statement
assignment
identifier "partial"
= "="
call
identifier "PartialTemplate"
argument_list
( "("
call
identifier "NodeList"
argument_list
( "("
) ")"
, ","
call
identifier "Origin"
argument_list
( "("
string
string_start "\""
string_content "test"
string_end "\""
) ")"
, ","
string
string_start "\""
string_content "test"
string_end "\""
, ","
keyword_argument
identifier "source_start"
= "="
identifier "source_start"
, ","
keyword_argument
identifier "source_end"
= "="
identifier "source_end"
, ","
) ")"
expression_statement
assignment
identifier "result"
= "="
call
attribute
identifier "partial"
. "."
identifier "find_partial_source"
argument_list
( "("
string
string_start "\""
string_content "nonexistent-partial"
string_end "\""
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "result"
, ","
string
string_start "\""
string_end "\""
) ")"
decorated_definition
decorator (+30 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_empty_partial"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "empty_partial_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "result"
= "="
call
attribute
identifier "partial_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "result"
, ","
string
string_start "\""
string_content "{% partialdef empty %}{% endpartialdef %}"
string_end "\""
) ")"
decorated_definition
decorator (+35 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_multiple_consecutive_partials"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "consecutive_partials_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "empty_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "empty_result"
, ","
string
string_start "\""
string_content "{% partialdef empty %}{% endpartialdef %}"
string_end "\""
) ")"
expression_statement
assignment
identifier "other_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "other_result"
, ","
string
string_start "\""
string_content "{% partialdef other %}...{% endpartialdef %}"
string_end "\""
) ")"
function_definition (+121 nodes collapsed)
decorated_definition
decorator (+30 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_named_end_tag"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "named_end_tag_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "result"
= "="
call
attribute
identifier "partial_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "result"
, ","
string
string_start "\""
string_content "{% partialdef thing %}CONTENT{% endpartialdef thing %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_basic_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials_and_named_"...
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_named_end_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef inner %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials_and_mixed_"...
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_mixed_end_1_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef %}"
string_end "\""
) ")"
decorated_definition
decorator (+39 nodes collapsed)
function_definition
def "def"
identifier "test_find_partial_source_supports_nested_partials_and_mixed_"...
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "nested_partials_mixed_end_2_template"
string_end "\""
) ")"
expression_statement (+22 nodes collapsed)
expression_statement (+22 nodes collapsed)
expression_statement
assignment
identifier "outer_result"
= "="
call
attribute
identifier "empty_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement (+24 nodes collapsed)
expression_statement
assignment
identifier "inner_result"
= "="
call
attribute
identifier "other_proxy"
. "."
identifier "find_partial_source"
argument_list
( "("
attribute
identifier "template"
. "."
identifier "source"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
identifier "inner_result"
, ","
string
string_start "\""
string_content "{% partialdef inner %}...{% endpartialdef inner %}"
string_end "\""
) ")"
decorated_definition
decorator
@ "@"
call
identifier "setup"
argument_list
( "("
dictionary
{ "{"
pair
string
string_start "\""
string_content "partial_embedded_in_verbatim"
string_end "\""
: ":"
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "<p>Should be ignored</p>"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
) ")"
, ","
} "}"
, ","
keyword_argument
identifier "debug_only"
= "="
true "True"
, ","
) ")"
function_definition
def "def"
identifier "test_partial_template_embedded_in_verbatim"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_embedded_in_verbatim"
string_end "\""
) ")"
expression_statement
assignment
identifier "partial_template"
= "="
subscript
subscript
attribute
identifier "template"
. "."
identifier "extra_data"
[ "["
string
string_start "\""
string_content "partials"
string_end "\""
] "]"
[ "["
string
string_start "\""
string_content "testing-name"
string_end "\""
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "source"
, ","
string
string_start "\""
string_content
escape_sequence "\\n"
escape_sequence "\\n"
string_end "\""
, ","
) ")"
decorated_definition
decorator
@ "@"
call
identifier "setup"
argument_list
( "("
dictionary
{ "{"
pair
string
string_start "\""
string_content "partial_debug_source"
string_end "\""
: ":"
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
) ")"
, ","
} "}"
, ","
keyword_argument
identifier "debug_only"
= "="
true "True"
, ","
) ")"
function_definition
def "def"
identifier "test_partial_source_uses_offsets_in_debug"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_debug_source"
string_end "\""
) ")"
expression_statement
assignment
identifier "partial_template"
= "="
subscript
subscript
attribute
identifier "template"
. "."
identifier "extra_data"
[ "["
string
string_start "\""
string_content "partials"
string_end "\""
] "]"
[ "["
string
string_start "\""
string_content "testing-name"
string_end "\""
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "_source_start"
, ","
integer "0"
) ")"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "_source_end"
, ","
integer "64"
) ")"
expression_statement
assignment
identifier "expected"
= "="
subscript
attribute
identifier "template"
. "."
identifier "source"
[ "["
slice
attribute
identifier "partial_template"
. "."
identifier "_source_start"
: ":"
attribute
identifier "partial_template"
. "."
identifier "_source_end"
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "source"
, ","
identifier "expected"
) ")"
decorated_definition
decorator
@ "@"
call
identifier "setup"
argument_list
( "("
dictionary
{ "{"
pair
string
string_start "\""
string_content "partial_embedded_in_named_verbatim"
string_end "\""
: ":"
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
) ")"
, ","
} "}"
, ","
keyword_argument
identifier "debug_only"
= "="
true "True"
, ","
) ")"
function_definition
def "def"
identifier "test_partial_template_embedded_in_named_verbatim"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_embedded_in_named_verbatim"
string_end "\""
) ")"
expression_statement
assignment
identifier "partial_template"
= "="
subscript
subscript
attribute
identifier "template"
. "."
identifier "extra_data"
[ "["
string
string_start "\""
string_content "partials"
string_end "\""
] "]"
[ "["
string
string_start "\""
string_content "testing-name"
string_end "\""
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
string
string_start "\""
string_content
escape_sequence "\\n"
escape_sequence "\\n"
string_end "\""
, ","
attribute
identifier "partial_template"
. "."
identifier "source"
, ","
) ")"
decorated_definition
decorator
@ "@"
call
identifier "setup"
argument_list
( "("
dictionary
{ "{"
pair
string
string_start "\""
string_content "partial_embedded_in_comment_block"
string_end "\""
: ":"
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
) ")"
, ","
} "}"
, ","
keyword_argument
identifier "debug_only"
= "="
true "True"
, ","
) ")"
function_definition
def "def"
identifier "test_partial_template_embedded_in_comment_block"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_embedded_in_comment_block"
string_end "\""
) ")"
expression_statement
assignment
identifier "partial_template"
= "="
subscript
subscript
attribute
identifier "template"
. "."
identifier "extra_data"
[ "["
string
string_start "\""
string_content "partials"
string_end "\""
] "]"
[ "["
string
string_start "\""
string_content "testing-name"
string_end "\""
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "source"
, ","
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "{% endpartialdef %}"
string_end "\""
, ","
) ")"
decorated_definition
decorator
@ "@"
call
identifier "setup"
argument_list
( "("
dictionary
{ "{"
pair
string
string_start "\""
string_content "partial_embedded_in_inline_comment"
string_end "\""
: ":"
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
) ")"
, ","
} "}"
, ","
keyword_argument
identifier "debug_only"
= "="
true "True"
, ","
) ")"
function_definition
def "def"
identifier "test_partial_template_embedded_in_inline_comment"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_embedded_in_inline_comment"
string_end "\""
) ")"
expression_statement
assignment
identifier "partial_template"
= "="
subscript
subscript
attribute
identifier "template"
. "."
identifier "extra_data"
[ "["
string
string_start "\""
string_content "partials"
string_end "\""
] "]"
[ "["
string
string_start "\""
string_content "testing-name"
string_end "\""
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "source"
, ","
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "{% endpartialdef %}"
string_end "\""
, ","
) ")"
decorated_definition
decorator
@ "@"
call
identifier "setup"
argument_list
( "("
dictionary
{ "{"
pair
string
string_start "\""
string_content "partial_contains_fake_end_inside_verbatim"
string_end "\""
: ":"
parenthesized_expression
( "("
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
) ")"
, ","
} "}"
, ","
keyword_argument
identifier "debug_only"
= "="
true "True"
, ","
) ")"
function_definition
def "def"
identifier "test_partial_template_contains_fake_end_inside_verbatim"
parameters
( "("
identifier "self"
) ")"
: ":"
block
expression_statement
assignment
identifier "template"
= "="
call
attribute
attribute
identifier "self"
. "."
identifier "engine"
. "."
identifier "get_template"
argument_list
( "("
string
string_start "\""
string_content "partial_contains_fake_end_inside_verbatim"
string_end "\""
) ")"
expression_statement
assignment
identifier "partial_template"
= "="
subscript
subscript
attribute
identifier "template"
. "."
identifier "extra_data"
[ "["
string
string_start "\""
string_content "partials"
string_end "\""
] "]"
[ "["
string
string_start "\""
string_content "testing-name"
string_end "\""
] "]"
expression_statement
call
attribute
identifier "self"
. "."
identifier "assertEqual"
argument_list
( "("
attribute
identifier "partial_template"
. "."
identifier "source"
, ","
concatenated_string
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content
escape_sequence "\\n"
string_end "\""
string
string_start "\""
string_content "{% endpartialdef %}"
string_end "\""
, ","
) ")"