Skip to content

Commit

Permalink
✨ feat: refactor telegramify to async, add interpreter options
Browse files Browse the repository at this point in the history
- Convert telegramify function to async.
- Add interpreter options for flexible usage.
- Implement async image downloading in mermaid rendering.
- Update dependencies to include aiohttp for async operations.
- Revise playground scripts to handle async functions.
- Adjust markdownify_case and inspect_telegramify for new features.
- Bump version to 0.3.0 to reflect significant changes.
  • Loading branch information
sudoskys committed Dec 15, 2024
1 parent 60f78fa commit c94000d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/exp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@
load_dotenv()


class TestCase(unittest.TestCase):
def test_markdownify(self):
class TestCase(unittest.IsolatedAsyncioTestCase):
async def test_markdownify(self):
md = pathlib.Path(__file__).parent.joinpath("exp1.md").read_text(encoding="utf-8")
converted = markdownify(md)
self.assertEqual(server_t(converted), True)

def test_telegramify(self):
async def test_telegramify(self):
long_md = pathlib.Path(__file__).parent.joinpath("exp2.md").read_text(encoding="utf-8")
rendered = telegramify_markdown.telegramify(long_md)
rendered = await telegramify_markdown.telegramify(
content=long_md,
max_word_count=4090,
latex_escape=True,
interpreters_use=[
telegramify_markdown.interpreters.BaseInterpreter(),
telegramify_markdown.interpreters.MermaidInterpreter(),
]
)
self.assertEqual(isinstance(rendered, list), True)


Expand Down

0 comments on commit c94000d

Please sign in to comment.