• R/O
  • SSH

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Castle: The best Real-Time/Embedded/HighTech language EVER. Attempt 2


Commit MetaInfo

Révision9ddb4256ff0d33a9dd3ed56eeebbc8028591d654 (tree)
l'heure2023-09-29 18:24:40
AuteurAlbert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Message de Log

small refactoring

Change Summary

Modification

diff -r 135bf69feaf3 -r 9ddb4256ff0d pytst/writers/RPy/test_0_templating.py
--- a/pytst/writers/RPy/test_0_templating.py Fri Sep 29 11:15:26 2023 +0200
+++ b/pytst/writers/RPy/test_0_templating.py Fri Sep 29 11:24:40 2023 +0200
@@ -8,16 +8,24 @@
88 from . import *
99 from castle.writers import RPy
1010
11-template_dir ="./templates/"
12-t_dir = get_dirPath_of_file(__file__) / template_dir
11+my_dir = get_dirPath_of_file(__file__)
12+template_r_dir = "./templates/"
13+template_a_dir = my_dir / template_r_dir
1314
1415 def test_simpel_template():
1516 HW_file = 'HW_template.txt'
16-
17- template = RPy.Template(template=HW_file, search_path=t_dir)
17+ template = RPy.Template(template=HW_file, search_path=template_a_dir)
1818 out=template.render(Hello='{{Hello}}', World='{{World}}') # Generates itself
1919
20- ref=open(t_dir / HW_file).read()
20+ ref=open(template_a_dir / HW_file).read()
21+ assert end_with_NL(ref) == end_with_NL(out), f"ref::\n{ref}\nout::\n{out}\nDo not match"
22+
23+def test_simpel_template_2():
24+ HW_file = 'HW_template.txt'
25+ template = RPy.Template(template=HW_file, top_dir=my_dir)
26+ out=template.render(Hello='{{Hello}}', World='{{World}}') # Generates itself
27+
28+ ref=open(template_a_dir / HW_file).read()
2129 assert end_with_NL(ref) == end_with_NL(out), f"ref::\n{ref}\nout::\n{out}\nDo not match"
2230
2331
@@ -25,10 +33,10 @@
2533 child = 'child.txt'
2634 base = 'base.txt' # Not used to render, only to test
2735
28- template = RPy.Template(template=child, search_path=t_dir)
36+ template = RPy.Template(template=child, search_path=template_a_dir)
2937 out = template.render(v1 ='Var 1', v2 ='Var 2', TOP='top: but not completely', BOTTOM="bottom, really")
3038
31- ref_lines = open(t_dir / base).readlines()
39+ ref_lines = open(template_a_dir / base).readlines()
3240 out_lines = out.splitlines(keepends=True)
3341
3442 assert ref_lines[0] == out_lines[0], "Rendering child, should return the topline of base"
@@ -44,7 +52,7 @@
4452 def test_template_parts():
4553 big_file = "big.txt" # Uses: part-include.txt & part-import.txt
4654
47- template = RPy.Template(template=big_file, search_path=t_dir)
55+ template = RPy.Template(template=big_file, search_path=template_a_dir)
4856 out = template.render()
4957
5058 assert 'INCLUDED' in out, "this line in part-include.txt"