Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
codeblock = codeblock_converter(inspect.cleandoc(text))
assert isinstance(codeblock, Codeblock)
assert codeblock.content.strip() == 'se``ven'
assert not codeblock.language
text = "``ei`ght``"
codeblock = codeblock_converter(text)
assert isinstance(codeblock, Codeblock)
assert codeblock.content.strip() == 'ei`ght'
assert not codeblock.language
text = "`nine`"
codeblock = codeblock_converter(text)
assert isinstance(codeblock, Codeblock)
assert codeblock.content.strip() == 'nine'
assert not codeblock.language
def test_codeblock_converter():
text = """
```py
one
```
"""
codeblock = codeblock_converter(inspect.cleandoc(text))
assert isinstance(codeblock, Codeblock)
assert codeblock.content.strip() == 'one'
assert codeblock.language == 'py'
text = """
```sql
two
```
"""
codeblock = codeblock_converter(inspect.cleandoc(text))
assert isinstance(codeblock, Codeblock)
assert codeblock.content.strip() == 'two'
assert codeblock.language == 'sql'
text = """
async def jsk_git(self, ctx: commands.Context, *, argument: codeblock_converter):
"""
Shortcut for 'jsk sh git'. Invokes the system shell.
"""
return await ctx.invoke(self.jsk_shell, argument=Codeblock(argument.language, "git " + argument.content))