Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AkulS1008 committed Jun 16, 2022
1 parent edecd9b commit 15a543b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 3 additions & 3 deletions dputils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ def save_data(path : str, data : str) -> bool:
"""
status = False
file_type = __file_type__(path)
if file_type == 1:
if file_type == 3:
status = __txt_file_write__(path, data)
if file_type == 2:
status = __pdf_write__(path, data)
if file_type == 3:
if file_type == 1:
status = __doc_write__(path, data)
return status

Expand Down Expand Up @@ -122,7 +122,7 @@ def __pdf_write__(path : str, data : str) -> bool:
def __doc_write__(path : str, data : str) -> bool:
try:
paras = data.split('\n')
document = Document(path)
document = Document()
for para in paras:
document.add_paragraph(para)
document.save(path)
Expand Down
Binary file removed examples/example.docx
Binary file not shown.
Binary file modified examples/sample.docx
Binary file not shown.
Binary file modified examples/sample.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
def test_read_file():
assert len(get_data(r"/Users/akulsingh/Desktop/Internship/pyproject.toml")) > 0
assert type(get_data(r"/Users/akulsingh/Desktop/Internship/pyproject.toml")) == str
def test_read_doc():
assert len(get_data(r"/Users/akulsingh/Desktop/Internship/examples/example.docx")) > 0
assert type(get_data(r"/Users/akulsingh/Desktop/Internship/examples/example.docx")) == str
# test_read_doc():
#assert len(get_data(r"/Users/akulsingh/Desktop/Internship/examples/example.docx")) > 0
#assert type(get_data(r"/Users/akulsingh/Desktop/Internship/examples/example.docx")) == str
def test_read_pdf():
assert len(get_data(r"/Users/akulsingh/Desktop/Internship/examples/sample.pdf")) > 0
assert type(get_data(r"/Users/akulsingh/Desktop/Internship/examples/sample.pdf")) == str
Expand Down

0 comments on commit 15a543b

Please sign in to comment.