def reboot_spec() -> Do: before = yield call_once_defined(reboot_test) json = yield N.e(dump_json(update_query)) yield nvim_command(f'CrmUpdateState {json}') yield seen_program('update_state') updated_path = yield await_k(check_path) yield nvim_command('CrmUpdate') yield nvim_command('CrmReboot') yield wait_for_function_undef(reboot_test) after = yield call_once_defined(reboot_test) return updated_path & (k(before) == 13) & (k(after) == 17)
def _code_json(a: A) -> Do: json = yield dump_json(a) yield decode_json(json)
def codec_either(self) -> None: v = Ei(Right(E(7, 'value')), Right(List(5, 9)), Left('error')) json = dump_json(v) (json // decode_json).should.equal(Right(v))
def codec_dat(self) -> None: target = D(E(2, 'E'), 1, 'D') json = f'{{"e": {{"a": 2, "b": "E", "{tpe_key}": "{mod}.E"}}, "a": 1, "b": "D", "{tpe_key}": "{mod}.D"}}' decoded = decode_json(json) decoded.should.equal(Right(target)) dump_json(target).should.equal(Right(json))
def env(self) -> Expectation: ready = List('one') env = Env.cons(ready=ready) json = dump_json(env) restored = json // decode_json / _.ready return k(restored).must(be_right(ready))
def venv(self) -> Expectation: p = Path('/') rplugin = simple_rplugin('spec', 'name') venv = Venv(rplugin, VenvMeta(rplugin.name, p, Right(p), Right(p))) return k(dump_json(venv)).must(be_right)