correspond.testing#
An in-memory channel for tests and rehearsals, and python -m correspond.testing: the CLI with it registered.
FakeChannel reads the conversations it was seeded with and records what it is
asked to send. It implements Reader and Writer only, so every other operation
raises NotSupported, exactly as a real channel without that operation does. Nothing it
does leaves the process, which makes it the channel to rehearse a workflow on:
python -m correspond.testing read fake:example/demo
python -m correspond.testing send fake:example/demo "hello" --dry-run
>>> fake = demo_channel()
>>> [m.text for m in fake.read(fake.parse_ref("example/demo"))]
['The export drops the last row.', 'Seen it too, on the CSV export.']
Functions
|
A |
|
A fictional message, for examples and tests. |
|
The ordinary |
Classes
|
A channel held in memory: seeded conversations to read, and a record of sends ( |
- class correspond.testing.FakeChannel(name='fake', *, conversations=None)[source]#
Bases:
objectA channel held in memory: seeded conversations to read, and a record of sends (
sent).- property capabilities: Capabilities#
Read and send, with a small text limit; nothing else.
- prepare(ref, draft)[source]#
The draft as it will post: the
notifymentions the text lacks added. Pure.- Return type:
- send(ref, draft, *, dry_run=False)[source]#
Append to the conversation (or, with
dry_run, say that it would).draft.notifyhandles the text does not @mention are mentioned on a closingccline, as a mention platform’s writer does (sentkeeps the draft as given; the conversation holds the text as posted).- Return type:
- correspond.testing.demo_channel(name='fake')[source]#
A
FakeChannelseeded with one short conversation,example/demo.- Return type:
- correspond.testing.demo_message(*, conversation='fake:example/demo', text='The export drops the last row.', message_id='m1', handle='ada', grade=Grade.PLATFORM, labels=(), is_self=False, reply_to=None, sent_at=datetime.datetime(2026, 9, 11, 9, 0, tzinfo=datetime.timezone.utc))[source]#
A fictional message, for examples and tests.
- Return type: