-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from DHI/feature/chainage_indexing
Feature/chainage indexing
- Loading branch information
Showing
5 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
""" | ||
The purpose of this test is to verify that the autocompletion of a network is working as expected. | ||
""" | ||
|
||
import pytest | ||
from IPython.terminal.interactiveshell import TerminalInteractiveShell | ||
|
||
from typing import List | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def shell(): | ||
shell = TerminalInteractiveShell() | ||
shell.run_cell( | ||
""" | ||
from mikeio1d import Res1D | ||
from tests import testdata | ||
res = Res1D(testdata.network_river_res1d) | ||
""" | ||
) | ||
return shell | ||
|
||
|
||
def complete(shell, prompt) -> List[str]: | ||
prompt, completions = shell.complete(prompt) | ||
completions = [c[len(prompt) :] for c in completions] | ||
return completions | ||
|
||
|
||
def test_reach_names(shell): | ||
completions = complete(shell, "res.reaches['") | ||
assert "river" in completions | ||
|
||
|
||
def test_reach_chainages(shell): | ||
completions = complete(shell, "res.reaches['river']['") | ||
assert "53100.000" in completions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters