Skip to content

Commit

Permalink
#17, updated tests. Believe the problem of different behaviour on loc…
Browse files Browse the repository at this point in the history
…al and github is solved. Updated one test input file as it was wrong. Not sure what has happened there
  • Loading branch information
tomarnepedersen committed Jan 25, 2024
1 parent 4fdef98 commit e625f95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
2 changes: 1 addition & 1 deletion tests/data/test_08/test_08_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"encounter": [
{
"desiredEncounterType": "head-on",
"beta": 2.0,
"beta": 10.0,
"relativeSpeed": 1.2,
"vectorTime": 15.0
}
Expand Down
18 changes: 2 additions & 16 deletions tests/test_trafficgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ def test_gen_situations_1_ts_full_spec_cli(
# sourcery skip: no-loop-in-tests
for situation in situations:
assert situation.target_ships is not None
# @TODO: See comment in test_gen_situations_1_ts_partly_spec_cli().
# Same behaviour and reason for below change here.
assert len(situation.target_ships) in {0, 1}
assert len(situation.target_ships) == 1


def test_gen_situations_1_ts_partly_spec_cli(
Expand Down Expand Up @@ -167,17 +165,6 @@ def test_gen_situations_1_ts_partly_spec_cli(
# sourcery skip: no-loop-in-tests
for situation in situations:
assert situation.target_ships is not None
# @TODO: @TomArne: As again the tests on GitHub failed here,
# I have for now adapted the assertion to not test for
# "== 1" but for "in {0,1}"
# i.e. allowing the resulting number of target ships to be also 0.
# However, we should find out one day what exactly the reason is,
# and resolve it (or adjust the tests) (or delete this note :-)).
# This behaviour occurs by the way only when running the CLI test.
# The test "sister" test in test_read_files.py, which contains mostly
# the same assertions but leaves out the CLI part, does not show this
# behaviour when run in GitHub.
# Claas, 2023-11-25
assert len(situation.target_ships) == 1


Expand Down Expand Up @@ -381,9 +368,8 @@ def test_gen_situations_baseline_cli(
assert "Generating traffic situations" in result.output

situations: List[TrafficSituation] = read_generated_situation_files(output_folder)
# assert len(situations) == 5

# sourcery skip: no-loop-in-tests
for situation in situations:
assert situation.target_ships is not None
assert len(situation.target_ships) in {1, 2, 3}
assert len(situation.target_ships) == 0

0 comments on commit e625f95

Please sign in to comment.