-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
tests/test_data/test_tuple/tests.test_tuple.TestTuple.test_read.yaml
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,19 @@ | ||
_requre: | ||
DataTypes: 1 | ||
key_strategy: StorageKeysInspectSimple | ||
version_storage_file: 3 | ||
tests.testbase: | ||
ret: | ||
- metadata: | ||
latency: 9.5367431640625e-07 | ||
module_call_list: | ||
- unittest.case | ||
- requre.online_replacing | ||
- tests.test_tuple | ||
- requre.objects | ||
- requre.cassette | ||
- tests.testbase | ||
- ret | ||
output: | ||
- ret | ||
- 2 |
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,26 @@ | ||
import sys | ||
import tempfile | ||
from requre.helpers.simple_object import Tuple | ||
from requre.online_replacing import apply_decorator_to_all_methods, replace | ||
from requre.cassette import Cassette, StorageMode | ||
from tests.testbase import BaseClass, RetTuple | ||
|
||
|
||
@apply_decorator_to_all_methods( | ||
replace(what="tests.testbase.RetTuple.ret", decorate=Tuple.decorator_plain()) | ||
) | ||
class TestTuple(BaseClass): | ||
def test_write(self, cassette: Cassette): | ||
cassette.storage_file = tempfile.mktemp() | ||
out = RetTuple().ret(1) | ||
self.assertEqual(out, ("ret", 1)) | ||
|
||
def test_read(self, cassette: Cassette): | ||
print(cassette.storage_file) | ||
print([k for k, v in sys.modules.items() if "tests" in k]) | ||
if cassette.mode == StorageMode.write: | ||
out = RetTuple().ret(2) | ||
self.assertEqual(out, ("ret", 2)) | ||
else: | ||
out = RetTuple().ret(1) | ||
self.assertEqual(out, ("ret", 2)) |
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