"""
test panflute ast to markdown conversion
"""
from .context import table2csv
from panflute import *
import pickle


def test_table2csv():
    # get_table_body
    markdown = """| 1 | 2 | 3 | 4 |
|:--|--:|:-:|---|
| 1 | 2 | 3 | 4 |

: *abcd*
"""
    Panflute = convert_text(markdown)
    code_block = table2csv(*Panflute, {})
    assert str(code_block) == '''CodeBlock(---
alignment: LRCD
caption: '*abcd*'
header: true
markdown: true
table-width: 0
width: [0, 0, 0, 0]
---
1,2,3,4\r\n1,2,3,4\r\n; classes=['table'])'''
    return

@@ -100,22 +100,8 @@
 t *%0A
-import pickle%0A
 %0A%0Ade
@@ -315,37 +315,32 @@
     
-assert str(code_block) == '''
+code_block_referenced = 
 Code
@@ -345,16 +345,19 @@
 deBlock(
+'''
 ---%0Aalig
@@ -479,9 +479,12 @@
 %5Cr%5Cn
-;
+''',
  cla
@@ -498,19 +498,75 @@
 table'%5D)
-'''
+%0A    assert repr(code_block) == repr(code_block_referenced)
 %0A    ret

improve test on assertion about a panflute AST in pantable2csv