|
1 | 1 | import os |
2 | 2 | from .context import YarnRunner |
3 | 3 |
|
4 | | -compiled_yarn_f = open(os.path.join(os.path.dirname( |
| 4 | +compiled_yarn_f1 = open(os.path.join(os.path.dirname( |
5 | 5 | __file__), '../examples/yarn1/jump.yarnc'), 'rb') |
6 | | -names_csv_f = open(os.path.join(os.path.dirname( |
| 6 | +names_csv_f1 = open(os.path.join(os.path.dirname( |
7 | 7 | __file__), '../examples/yarn1/jump.csv'), 'r') |
| 8 | +compiled_yarn_f2 = open(os.path.join(os.path.dirname( |
| 9 | + __file__), '../examples/yarn2/jump.yarnc'), 'rb') |
| 10 | +names_csv_f2 = open(os.path.join(os.path.dirname( |
| 11 | + __file__), '../examples/yarn2/jump.csv'), 'r') |
8 | 12 |
|
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) |
10 | 15 |
|
11 | 16 |
|
12 | | -def test_start_node_text(): |
13 | | - assert "This is a test of the jump functionality." == runner.get_line() |
14 | | - assert not runner.has_line() |
15 | | - assert not runner.finished |
| 17 | +def test_start_node_text1(): |
| 18 | + assert "This is a test of the jump functionality." == runner1.get_line() |
| 19 | + assert not runner1.has_line() |
| 20 | + assert not runner1.finished |
16 | 21 |
|
17 | 22 |
|
18 | | -def test_start_node_choices(): |
19 | | - choices = runner.get_choices() |
| 23 | +def test_start_node_choices1(): |
| 24 | + choices = runner1.get_choices() |
20 | 25 |
|
21 | 26 | assert len(choices) == 1 |
22 | 27 | assert choices[0]["choice"] == "begin_jump" |
23 | 28 | assert choices[0]["text"] == "Begin Jump" |
24 | 29 |
|
25 | 30 |
|
26 | | -def test_jumps(): |
27 | | - runner.choose(0) |
| 31 | +def test_jumps1(): |
| 32 | + runner1.choose(0) |
28 | 33 |
|
29 | | - assert "Some text is output." == runner.get_line() |
30 | | - assert runner.has_line() |
31 | | - assert "The jump is now complete." == runner.get_line() |
32 | | - assert not runner.has_line() |
33 | | - assert runner.finished |
34 | | - assert runner.current_node == 'jump_complete' |
| 34 | + assert "Some text is output." == runner1.get_line() |
| 35 | + assert runner1.has_line() |
| 36 | + assert "The jump is now complete." == runner1.get_line() |
| 37 | + assert not runner1.has_line() |
| 38 | + assert runner1.finished |
| 39 | + assert runner1.current_node == 'jump_complete' |
| 40 | + |
| 41 | + |
| 42 | +def test_start_node_text2(): |
| 43 | + assert "This is a test of the jump functionality." == runner2.get_line() |
| 44 | + assert not runner2.has_line() |
| 45 | + assert not runner2.finished |
| 46 | + |
| 47 | + |
| 48 | +def test_start_node_choices2(): |
| 49 | + choices = runner2.get_choices() |
| 50 | + |
| 51 | + assert len(choices) == 1 |
| 52 | + assert choices[0]["text"] == "Begin Jump" |
| 53 | + |
| 54 | + |
| 55 | +def test_jumps2(): |
| 56 | + runner2.choose(0) |
| 57 | + |
| 58 | + assert "Some text is output." == runner2.get_line() |
| 59 | + assert runner2.has_line() |
| 60 | + assert "The jump is now complete." == runner2.get_line() |
| 61 | + assert not runner2.has_line() |
| 62 | + assert runner2.finished |
| 63 | + assert runner2.current_node == 'jump_complete' |
0 commit comments