Skip to content

Commit f9c1cae

Browse files
committed
Whoops, fixed bug with variables test. Now can release 0.2.1.
1 parent 2e5c1cc commit f9c1cae

5 files changed

Lines changed: 30 additions & 11 deletions

File tree

examples/yarn2/variables.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id,text,file,node,lineNumber

examples/yarn2/variables.yarn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
title: Start
2+
---
3+
<<set $value_string to "string">>
4+
<<set $value_float to 1.25>>
5+
<<set $value_bool to true>>
6+
===

examples/yarn2/variables.yarnc

197 Bytes
Binary file not shown.

tests/test_variables.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
11
import os
22
from .context import YarnRunner
33

4-
compiled_yarn_f = open(os.path.join(os.path.dirname(
4+
compiled_yarn_f1 = open(os.path.join(os.path.dirname(
55
__file__), '../examples/yarn1/variables.yarnc'), 'rb')
6-
names_csv_f = open(os.path.join(os.path.dirname(
6+
names_csv_f1 = open(os.path.join(os.path.dirname(
77
__file__), '../examples/yarn1/variables.csv'), 'r')
8+
compiled_yarn_f2 = open(os.path.join(os.path.dirname(
9+
__file__), '../examples/yarn2/variables.yarnc'), 'rb')
10+
names_csv_f2 = open(os.path.join(os.path.dirname(
11+
__file__), '../examples/yarn2/variables.csv'), 'r')
812

9-
runner = YarnRunner(compiled_yarn_f, names_csv_f)
13+
runner1 = YarnRunner(compiled_yarn_f1, names_csv_f1)
14+
runner2 = YarnRunner(compiled_yarn_f2, names_csv_f2)
1015

1116

12-
def test_variables():
13-
assert not runner.has_line()
14-
assert runner.finished
15-
assert runner.variables["$value_string"] == "string"
16-
assert runner.variables["$value_float"] == 1.25
17-
assert runner.variables["$value_bool"] == True
18-
assert runner.variables["$value_null"] is None
17+
def test_variables1():
18+
assert not runner1.has_line()
19+
assert runner1.finished
20+
assert runner1.variables["$value_string"] == "string"
21+
assert runner1.variables["$value_float"] == 1.25
22+
assert runner1.variables["$value_bool"] == True
23+
assert runner1.variables["$value_null"] is None
1924

20-
# TODO, the variables.yarnc wouldn't compile under YSC 2.0.1-a2eff4c
25+
26+
def test_variables2():
27+
assert not runner2.has_line()
28+
assert runner2.finished
29+
assert runner2.variables["$value_string"] == "string"
30+
assert runner2.variables["$value_float"] == 1.25
31+
assert runner2.variables["$value_bool"] == True

variables-metadata.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id,node,lineNumber,tags

0 commit comments

Comments
 (0)