forked from mrlan/EnglishPal
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
|
import math
|
||
|
|
||
|
from vocabulary import ArticleVocabularyLevel, UserVocabularyLevel
|
||
|
|
||
|
|
||
|
def test_article_level():
|
||
|
''' Boundary case test '''
|
||
|
article = ArticleVocabularyLevel('')
|
||
|
assert article.level == 0
|
||
|
|
||
|
def test_user_level():
|
||
|
''' Boundary case test '''
|
||
|
user = UserVocabularyLevel({})
|
||
|
assert user.level == 0
|
||
|
|
||
|
def test_article_level_3():
|
||
|
''' Normal case test '''
|
||
|
article = ArticleVocabularyLevel('This is an interesting article that frequently uses the word "banana".')
|
||
|
assert article.level == 3.090909090909091
|
||
|
|
||
|
def test_user_level_4():
|
||
|
''' Normal case test '''
|
||
|
d = {'apple': ['BBC', 'CTE4'], 'banana': ['BBC', 'CTE4']}
|
||
|
user = UserVocabularyLevel(d)
|
||
|
assert user.level == 4.0
|
||
|
|
||
|
def test_article_level_5():
|
||
|
''' Abnormal case test '''
|
||
|
article = ArticleVocabularyLevel('This is an interesting article that frequently uses the word "banana".')
|
||
|
assert article.level != 5.0
|
||
|
|
||
|
def test_user_level_6():
|
||
|
''' Abnormal case test '''
|
||
|
d = {'apple': ['BBC', 'CTE4'], 'banana': ['BBC', 'CTE4']}
|
||
|
user = UserVocabularyLevel(d)
|
||
|
assert user.level != 6.0
|