Skip to content

Commit

Permalink
2018.6.27 v1.0.14, add fish_csv unittest #72
Browse files Browse the repository at this point in the history
  • Loading branch information
Chunying Jia committed Jun 27, 2018
1 parent 0a4d3a8 commit 84d470f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -105,3 +105,7 @@ venv.bak/
test/log
/_build/*
demo/log

# test cache data
test/.test_cache_data/*
test/.test_cache_data
25 changes: 25 additions & 0 deletions test/test_csv.py
@@ -0,0 +1,25 @@
import os
import shutil
from fishbase.fish_csv import csv_file_to_list


# 2018.6.27 v1.0.14 #73 create by Jia ChunYing
class TestCsv(object):

# 测试 csv_file_to_list() tc
def test_csv(self):
# 创建csv测试文件
csv_file_name = '.test_cache_data/test_file.csv'
if os.path.isfile(csv_file_name):
os.remove(csv_file_name)
if not os.path.exists(os.path.dirname(csv_file_name)):
os.makedirs(os.path.dirname(csv_file_name))
csv_content = "a,b\n1,2"
with open(csv_file_name, 'w') as f:
f.write(csv_content)
f.close()
result = csv_file_to_list(csv_file_name)
shutil.rmtree(os.path.dirname(csv_file_name))
assert len(result) == 2
assert len(result[0]) == 2
assert len(result[1]) == 2

0 comments on commit 84d470f

Please sign in to comment.