test: added test cases for kata Chinese Numeral Encoder
This commit is contained in:
parent
030979e4a0
commit
5ab3c0535a
36
tests/test_codewars/test_chinese_numeral_encoder.py
Normal file
36
tests/test_codewars/test_chinese_numeral_encoder.py
Normal file
@ -0,0 +1,36 @@
|
||||
from src.codewars.kata_chinese_numeral_encoder import to_chinese_numeral
|
||||
|
||||
"""
|
||||
In preloaded:
|
||||
numerals = {
|
||||
"-":"负",
|
||||
".":"点",
|
||||
0:"零",
|
||||
1:"一",
|
||||
2:"二",
|
||||
3:"三",
|
||||
4:"四",
|
||||
5:"五",
|
||||
6:"六",
|
||||
7:"七",
|
||||
8:"八",
|
||||
9:"九",
|
||||
10:"十",
|
||||
100:"百",
|
||||
1000:"千",
|
||||
10000:"万"
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def test_to_chinese():
|
||||
assert to_chinese_numeral(9) == "九"
|
||||
assert to_chinese_numeral(-5) == "负五"
|
||||
assert to_chinese_numeral(0.5) == "零点五"
|
||||
assert to_chinese_numeral(10) == "十"
|
||||
assert to_chinese_numeral(110) == "一百一十"
|
||||
assert to_chinese_numeral(111) == "一百一十一"
|
||||
assert to_chinese_numeral(1000) == "一千"
|
||||
assert to_chinese_numeral(10000) == "一万"
|
||||
assert to_chinese_numeral(10006) == "一万零六"
|
||||
assert to_chinese_numeral(10306.005) == "一万零三百零六点零零五"
|
||||
Loading…
x
Reference in New Issue
Block a user