forked from bluesky/tiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added first draft for test case on smoke read
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import collections | ||
|
||
import pytest | ||
|
||
from ..adapters.array import ArrayAdapter | ||
from ..adapters.mapping import MapAdapter | ||
from ..client import Context, from_context | ||
from ..client.smoke import read | ||
from ..server.app import build_app | ||
|
||
|
||
def f(): | ||
raise Exception("test!") | ||
|
||
|
||
def test_smoke_read(): | ||
data = collections.defaultdict(f) | ||
data["A"] = ArrayAdapter.from_array([1, 2, 3], metadata={"A": "a"}) | ||
|
||
tree = MapAdapter(data) | ||
with Context.from_app(build_app(tree)) as context: | ||
client = from_context(context) | ||
|
||
faulty_list = read(client) | ||
assert len(faulty_list) == 1 | ||
|
||
with pytest.raises(Exception): | ||
data["B"] |