diff --git a/tests/data/a.yml b/tests/data/a.yml index 5d1a347..af881a5 100644 --- a/tests/data/a.yml +++ b/tests/data/a.yml @@ -1,2 +1,2 @@ -a1: 1 -a2: text +number: 1 +string: text diff --git a/tests/data/dir1.yml b/tests/data/dir1.yml new file mode 100644 index 0000000..af881a5 --- /dev/null +++ b/tests/data/dir1.yml @@ -0,0 +1,2 @@ +number: 1 +string: text diff --git a/tests/data/dir1/b.yml b/tests/data/dir1/b.yml index 796d9ba..6656b55 100644 --- a/tests/data/dir1/b.yml +++ b/tests/data/dir1/b.yml @@ -1,2 +1,2 @@ -b1: 2 -b2: text +number: 2 +string: text diff --git a/tests/data/dir2/c.json b/tests/data/dir2/c.json index 0146853..d9c73b6 100644 --- a/tests/data/dir2/c.json +++ b/tests/data/dir2/c.json @@ -1,4 +1,4 @@ { - "c1": 3, - "c2": "text" + "number": 3, + "string": "text" } diff --git a/tests/docs/test_dir_source.md b/tests/docs/test_dir_source.md index f06b5a4..0b26ea0 100644 --- a/tests/docs/test_dir_source.md +++ b/tests/docs/test_dir_source.md @@ -3,9 +3,9 @@ title: "Test Directory Source" --- - data.a: `{{ data.a }}` -- data.a.a1: `{{ data.a.a1 }}` -- data.a.a2: `{{ data.a.a2 }}` -- data.dir1.b.b1: `{{ data.dir1.b.b1 }}` -- data.dir1.b.b2: `{{ data.dir1.b.b2 }}` -- data.dir2.c.c1: `{{ data.dir2.c.c1 }}` -- data.dir2.c.c2: `{{ data.dir2.c.c2 }}` +- data.a.number: `{{ data.a.number }}` +- data.a.string: `{{ data.a.string }}` +- data.dir1.b.number: `{{ data.dir1.b.number }}` +- data.dir1.b.string: `{{ data.dir1.b.string }}` +- data.dir2.c.number: `{{ data.dir2.c.number }}` +- data.dir2.c.string: `{{ data.dir2.c.string }}` diff --git a/tests/test_data_template.py b/tests/test_data_template.py index 4120ca1..006b094 100644 --- a/tests/test_data_template.py +++ b/tests/test_data_template.py @@ -20,13 +20,13 @@ def test_dir_source_in_markdown_file(): data_loaded = re.findall(r"([^<]*)", f.read()) print(data_loaded) assert(data_loaded == [ - "{'a1': 1, 'a2': 'text'}", # data/a.yml - "1", # data/a.yml -> a1 - "text", # data/a.yml -> a2 - "2", # data/dir1/b.yml -> b1 - "text", # data/dir1/b.yml -> b2 - "3", # data/dir2/c.yml -> c1 - "text", # data/dir2/c.yml -> c2 + "{'number': 1, 'string': 'text'}", # data/a.yml + "1", # data/a.yml -> number + "text", # data/a.yml -> string + "2", # data/dir1/b.yml -> number + "text", # data/dir1/b.yml -> string + "3", # data/dir2/c.yml -> number + "text", # data/dir2/c.yml -> string ]) def test_file_source_in_markdown_file(): diff --git a/tests/test_load_data.py b/tests/test_load_data.py index 92b99a4..62d9e1d 100644 --- a/tests/test_load_data.py +++ b/tests/test_load_data.py @@ -32,19 +32,21 @@ def test_folder_source(): assert data == { "a": { - "a1": 1, - "a2": "text", + "number": 1, + "string": "text", }, "dir1": { + "number": 1, + "string": "text", "b": { - "b1": 2, - "b2": "text", + "number": 2, + "string": "text", }, }, "dir2": { "c": { - "c1": 3, - "c2": "text", + "number": 3, + "string": "text", }, }, } @@ -64,19 +66,21 @@ def test_folder_source_slash(): assert data == { "a": { - "a1": 1, - "a2": "text", + "number": 1, + "string": "text", }, "dir1": { + "number": 1, + "string": "text", "b": { - "b1": 2, - "b2": "text", + "number": 2, + "string": "text", }, }, "dir2": { "c": { - "c1": 3, - "c2": "text", + "number": 3, + "string": "text", }, }, }