コード例 #1
0
def test_divine_format():
    assert divine_format('{"cells":[]}') == 'ipynb'
    assert divine_format('''def f(x):
    x + 1''') == 'py:light'
    assert divine_format('''# %%
def f(x):
    x + 1

# %%
def g(x):
    x + 2
''') == 'py:percent'
    assert divine_format('''This is a markdown file
with one code block

```
1 + 1
```
''') == 'md'
    assert divine_format(''';; ---
;; jupyter:
;;   jupytext:
;;     text_representation:
;;       extension: .ss
;;       format_name: percent
;; ---''') == 'ss:percent'
コード例 #2
0
def test_divine_format():
    assert divine_format('{"cells":[]}') == "ipynb"
    assert (divine_format("""def f(x):
    x + 1""") == "py:light")
    assert (divine_format("""# %%
def f(x):
    x + 1

# %%
def g(x):
    x + 2
""") == "py:percent")
    assert (divine_format("""This is a markdown file
with one code block

```
1 + 1
```
""") == "md")
    assert (divine_format(""";; ---
;; jupyter:
;;   jupytext:
;;     text_representation:
;;       extension: .ss
;;       format_name: percent
;; ---""") == "ss:percent")