Skip to content

Commit

Permalink
Merge pull request #2 from vaaaaanquish/add_ut
Browse files Browse the repository at this point in the history
using poetry publish, add ut
  • Loading branch information
vaaaaanquish authored Apr 29, 2020
2 parents 1414558 + a4df80c commit ec782e4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry build
twine upload dist/*
poetry publish --build --username ${TWINE_USERNAME} --password ${TWINE_PASSWORD}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Cloudia
Tools to easily create a word cloud.


# Require

I'm waiting for this [PR](https://github.com/uehara1414/japanize-matplotlib/pull/9).
Expand Down
37 changes: 36 additions & 1 deletion test/unit_test/test_word_data.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,51 @@
from cloudia.word_data import WordData
import unittest
import pandas as pd


class TestCloudia(unittest.TestCase):
def setUp(self):
self.cls = WordData('test', [], [], None, None, None, lambda x: [x])

def test_init_data(self):
def test_init_data_string(self):
words, name = self.cls._init_data('test')
self.assertListEqual(words, ['test'])
self.assertListEqual(name, ['word cloud'])

def test_init_data_tuple(self):
words, name = self.cls._init_data(('name', 'test'))
self.assertListEqual(words, ['test'])
self.assertListEqual(name, ['name'])

def test_init_data_list_string(self):
words, name = self.cls._init_data(['test1 test2', 'test3'])
self.assertListEqual(words, ['test1 test2', 'test3'])
self.assertListEqual(name, ['word cloud 1', 'word cloud 2'])

def test_init_data_list_tuple_string(self):
words, name = self.cls._init_data([('wc1', 'test1 test2'), ('wc2', 'test3')])
self.assertListEqual(words, ['test1 test2', 'test3'])
self.assertListEqual(name, ['wc1', 'wc2'])

def test_init_data_list_tuple_series(self):
test_1 = pd.Series(['test1 test2', 'test3'], name='wc1')
test_2 = pd.Series(['test4', 'test5', 'test6'], name='wc2')
words, name = self.cls._init_data([('name1', test_1), ('name2', test_2)])
self.assertListEqual(words, ['test1 test2 test3', 'test4 test5 test6'])
self.assertListEqual(name, ['name1', 'name2'])

def test_init_data_dataframe(self):
test = pd.DataFrame({'wc1': ['test1', 'test2'], 'wc2': ['test3', 'test4']})
words, name = self.cls._init_data(test)
self.assertListEqual(words, ['test1 test2', 'test3 test4'])
self.assertListEqual(name, ['wc1', 'wc2'])

def test_init_data_series(self):
test = pd.Series(['test1', 'test2'], name='wc')
words, name = self.cls._init_data(test)
self.assertListEqual(words, ['test1 test2'])
self.assertListEqual(name, ['wc'])

def test_count(self):
self.cls.word_num = 2
self.cls.stop_words = 'test'
Expand Down

0 comments on commit ec782e4

Please sign in to comment.