Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
6ecf74c4
Commit
6ecf74c4
authored
Oct 26, 2011
by
chenguodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support to Simplified Chinese
parent
302ed79d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
217 additions
and
0 deletions
+217
-0
lettuce/languages.py
+9
-0
tests/functional/language_specific_features/test_zh-CN.py
+125
-0
tests/functional/language_specific_features/zh-CN/success/dumb.feature
+7
-0
tests/functional/language_specific_features/zh-CN/success/dumb_steps.py
+7
-0
tests/functional/language_specific_features/zh-CN/success/outlines.feature
+15
-0
tests/functional/language_specific_features/zh-CN/success/outlines_steps.py
+37
-0
tests/functional/language_specific_features/zh-CN/success/table.feature
+10
-0
tests/functional/language_specific_features/zh-CN/success/table_steps.py
+7
-0
No files found.
lettuce/languages.py
View file @
6ecf74c4
...
...
@@ -97,4 +97,13 @@ LANGUAGES = {
'scenario_outline'
:
u'シナリオアウトライン|シナリオテンプレート|テンプレ|シナリオテンプレ'
,
'scenario_separator'
:
u'(シナリオ|シナリオアウトライン|シナリオテンプレート|テンプレ|シナリオテンプレ)'
,
},
'zh-CN'
:
{
'examples'
:
u'例如|场景集'
,
'feature'
:
u'特性'
,
'name'
:
u'Simplified Chinese'
,
'native'
:
u'简体中文'
,
'scenario'
:
u'场景'
,
'scenario_outline'
:
u'场景模板'
,
'scenario_separator'
:
u'(场景模板|场景)'
,
},
}
tests/functional/language_specific_features/test_zh-CN.py
0 → 100644
View file @
6ecf74c4
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010-2011> Gabriel Falc達o <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from
os.path
import
dirname
,
abspath
,
join
from
nose.tools
import
with_setup
from
tests.asserts
import
prepare_stdout
from
tests.asserts
import
assert_stdout_lines
from
lettuce
import
Runner
current_dir
=
abspath
(
dirname
(
__file__
))
join_path
=
lambda
*
x
:
join
(
current_dir
,
*
x
)
@with_setup
(
prepare_stdout
)
def
test_output_with_success_colorless
():
"Language: zh-CN -> sucess colorless"
runner
=
Runner
(
join_path
(
'zh-CN'
,
'success'
,
'dumb.feature'
),
verbosity
=
3
)
runner
.
run
()
assert_stdout_lines
(
u"
\n
"
u"特性: 简单测试 # tests/functional/language_specific_features/zh-CN/success/dumb.feature:3
\n
"
u" 什么都不做应该运行成功 # tests/functional/language_specific_features/zh-CN/success/dumb.feature:4
\n
"
u"
\n
"
u" 场景: 什么都不做 # tests/functional/language_specific_features/zh-CN/success/dumb.feature:6
\n
"
u" 如果 什么都不做 # tests/functional/language_specific_features/zh-CN/success/dumb_steps.py:6
\n
"
u"
\n
"
u"1 feature (1 passed)
\n
"
u"1 scenario (1 passed)
\n
"
u"1 step (1 passed)
\n
"
)
@with_setup
(
prepare_stdout
)
def
test_output_of_table_with_success_colorless
():
"Language: zh-CN -> sucess table colorless"
runner
=
Runner
(
join_path
(
'zh-CN'
,
'success'
,
'table.feature'
),
verbosity
=
3
)
runner
.
run
()
assert_stdout_lines
(
u"
\n
"
u"特性: 步骤中包含表格 # tests/functional/language_specific_features/zh-CN/success/table.feature:3
\n
"
u" 简体中文表格步骤的成功测试 # tests/functional/language_specific_features/zh-CN/success/table.feature:4
\n
"
u"
\n
"
u" 场景: 什么都不做的表格步骤测试 # tests/functional/language_specific_features/zh-CN/success/table.feature:6
\n
"
u" 如果 输入数据如下: # tests/functional/language_specific_features/zh-CN/success/table_steps.py:6
\n
"
u" | id | 名称 |
\n
"
u" | 12 | 名称一 |
\n
"
u" | 64 | 名称二 |
\n
"
u"
\n
"
u"1 feature (1 passed)
\n
"
u"1 scenario (1 passed)
\n
"
u"1 step (1 passed)
\n
"
)
@with_setup
(
prepare_stdout
)
def
test_output_outlines_success_colorless
():
"Language: zh-CN -> sucess outlines colorless"
runner
=
Runner
(
join_path
(
'zh-CN'
,
'success'
,
'outlines.feature'
),
verbosity
=
3
)
runner
.
run
()
assert_stdout_lines
(
u"
\n
"
u"特性: 中文场景模板 # tests/functional/language_specific_features/zh-CN/success/outlines.feature:3
\n
"
u" 中文场景模板图表测试 # tests/functional/language_specific_features/zh-CN/success/outlines.feature:4
\n
"
u"
\n
"
u" 场景模板: 用表格描述场景 # tests/functional/language_specific_features/zh-CN/success/outlines.feature:6
\n
"
u" 如果 输入是<输入> # tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:13
\n
"
u" 当 执行<处理>时 # tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:22
\n
"
u" 那么 得到<结果> # tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:31
\n
"
u"
\n
"
u" 例如:
\n
"
u" | 输入 | 处理 | 结果 |
\n
"
u" | 什么 | 这个 | 功能 |
\n
"
u" | 其他 | 这里 | 一样 |
\n
"
u" | 数据 | 动作 | unicode输出! |
\n
"
u"
\n
"
u"1 feature (1 passed)
\n
"
u"3 scenarios (3 passed)
\n
"
u"9 steps (9 passed)
\n
"
)
@with_setup
(
prepare_stdout
)
def
test_output_outlines_success_colorful
():
"Language: zh-CN -> sucess outlines colorful"
runner
=
Runner
(
join_path
(
'zh-CN'
,
'success'
,
'outlines.feature'
),
verbosity
=
4
)
runner
.
run
()
assert_stdout_lines
(
u'
\n
'
u"
\033
[1;37m特性: 中文场景模板
\033
[1;30m# tests/functional/language_specific_features/zh-CN/success/outlines.feature:3
\033
[0m
\n
"
u"
\033
[1;37m 中文场景模板图表测试
\033
[1;30m# tests/functional/language_specific_features/zh-CN/success/outlines.feature:4
\033
[0m
\n
"
u'
\n
'
u"
\033
[1;37m 场景模板: 用表格描述场景
\033
[1;30m# tests/functional/language_specific_features/zh-CN/success/outlines.feature:6
\033
[0m
\n
"
u"
\033
[0;36m 如果 输入是<输入>
\033
[1;30m# tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:13
\033
[0m
\n
"
u"
\033
[0;36m 当 执行<处理>时
\033
[1;30m# tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:22
\033
[0m
\n
"
u"
\033
[0;36m 那么 得到<结果>
\033
[1;30m# tests/functional/language_specific_features/zh-CN/success/outlines_steps.py:31
\033
[0m
\n
"
u'
\n
'
u"
\033
[1;37m 例如:
\033
[0m
\n
"
u"
\033
[0;36m
\033
[1;37m |
\033
[0;36m 输入
\033
[1;37m |
\033
[0;36m 处理
\033
[1;37m |
\033
[0;36m 结果
\033
[1;37m |
\033
[0;36m
\033
[0m
\n
"
u"
\033
[1;32m
\033
[1;37m |
\033
[1;32m 什么
\033
[1;37m |
\033
[1;32m 这个
\033
[1;37m |
\033
[1;32m 功能
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
"
u"
\033
[1;32m
\033
[1;37m |
\033
[1;32m 其他
\033
[1;37m |
\033
[1;32m 这里
\033
[1;37m |
\033
[1;32m 一样
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
"
u"
\033
[1;32m
\033
[1;37m |
\033
[1;32m 数据
\033
[1;37m |
\033
[1;32m 动作
\033
[1;37m |
\033
[1;32m unicode输出!
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
"
u'
\n
'
u"
\033
[1;37m1 feature (
\033
[1;32m1 passed
\033
[1;37m)
\033
[0m
\n
"
u"
\033
[1;37m3 scenarios (
\033
[1;32m3 passed
\033
[1;37m)
\033
[0m
\n
"
u"
\033
[1;37m9 steps (
\033
[1;32m9 passed
\033
[1;37m)
\033
[0m
\n
"
)
tests/functional/language_specific_features/zh-CN/success/dumb.feature
0 → 100644
View file @
6ecf74c4
# -*- coding:utf-8 -*-
# language: zh-CN
特性
:
简单测试
什么都不做应该运行成功
场景
:
什么都不做
如果 什么都不做
tests/functional/language_specific_features/zh-CN/success/dumb_steps.py
0 → 100644
View file @
6ecf74c4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
lettuce
import
step
@step
(
u'什么都不做'
)
def
shen_me_dou_bu_zuo
(
step
):
pass
tests/functional/language_specific_features/zh-CN/success/outlines.feature
0 → 100644
View file @
6ecf74c4
# -*- coding: utf-8 -*-
# language: zh-CN
特性
:
中文场景模板
中文场景模板图表测试
场景模板
:
用表格描述场景
如果
输入是<输入>
当
执行<处理>时
那么
得到<结果>
例如
:
|
输入
|
处理
|
结果
|
|
什么
|
这个
|
功能
|
|
其他
|
这里
|
一样
|
|
数据
|
动作
|
unicode输出!
|
tests/functional/language_specific_features/zh-CN/success/outlines_steps.py
0 → 100644
View file @
6ecf74c4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
lettuce
import
step
def
assert_in
(
condition
,
possibilities
):
assert
condition
in
possibilities
,
\
u"
%
r 应该包含在:
%
r"
%
(
condition
,
possibilities
)
@step
(
u'输入是(.*)'
)
def
shu_ru
(
step
,
group
):
possibilities
=
[
u'什么'
,
u'其他'
,
u'数据'
]
assert_in
(
group
,
possibilities
)
@step
(
u'执行(.*)时'
)
def
zhi_xing
(
step
,
group
):
possibilities
=
[
u'这个'
,
u'这里'
,
u'动作'
]
assert_in
(
group
,
possibilities
)
@step
(
u'得到(.*)'
)
def
de_dao
(
step
,
group
):
possibilities
=
[
u'功能'
,
u'一样'
,
u'unicode输出!'
]
assert_in
(
group
,
possibilities
)
tests/functional/language_specific_features/zh-CN/success/table.feature
0 → 100644
View file @
6ecf74c4
# -*- coding: utf-8 -*-
# language: zh-CN
特性
:
步骤中包含表格
简体中文表格步骤的成功测试
场景
:
什么都不做的表格步骤测试
如果 输入数据如下
:
|
id
|
名称
|
|
12
|
名称一
|
|
64
|
名称二
|
tests/functional/language_specific_features/zh-CN/success/table_steps.py
0 → 100644
View file @
6ecf74c4
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
lettuce
import
step
@step
(
u'输入数据如下'
)
def
do_nothing_table
(
step
):
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment