Skip to content

Commit 6d9695a

Browse files
authored
Add test for CSV with pipe characters
Added a test for CSV conversion handling pipe characters.
1 parent 32bb49c commit 6d9695a

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import io
2+
from markitdown.converters._csv_converter import CsvConverter
3+
from markitdown._stream_info import StreamInfo
4+
5+
# Test CSV with pipe characters
6+
csv_content = b"""name,description
7+
John|Doe,Developer|Engineer
8+
Alice,Manager|Lead"""
9+
10+
converter = CsvConverter()
11+
stream_info = StreamInfo(extension=".csv", charset="utf-8")
12+
13+
result = converter.convert(
14+
io.BytesIO(csv_content),
15+
stream_info
16+
)
17+
18+
print(result.markdown)
19+
# Output should have escaped pipes:
20+
# | name | description |
21+
# | --- | --- |
22+
# | John\|Doe | Developer\|Engineer |
23+
# | Alice | Manager\|Lead |

0 commit comments

Comments
 (0)