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
40409bac
Commit
40409bac
authored
May 06, 2010
by
Gabriel Falcão
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first brainstorms on language support
parent
9983fec0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
4 deletions
+100
-4
lettuce/core.py
+18
-0
lettuce/languages.py
+35
-0
tests/functional/test_runner.py
+4
-4
tests/unit/test_language.py
+43
-0
No files found.
lettuce/core.py
View file @
40409bac
...
@@ -19,6 +19,7 @@ import re
...
@@ -19,6 +19,7 @@ import re
import
os
import
os
from
copy
import
deepcopy
from
copy
import
deepcopy
from
lettuce
import
strings
from
lettuce
import
strings
from
lettuce
import
languages
from
lettuce.registry
import
STEP_REGISTRY
from
lettuce.registry
import
STEP_REGISTRY
from
lettuce.registry
import
CALLBACK_REGISTRY
from
lettuce.registry
import
CALLBACK_REGISTRY
from
lettuce.exceptions
import
ReasonToFail
from
lettuce.exceptions
import
ReasonToFail
...
@@ -38,6 +39,23 @@ def parse_hashes(lines):
...
@@ -38,6 +39,23 @@ def parse_hashes(lines):
return
keys
,
hashes
return
keys
,
hashes
class
Language
(
object
):
code
=
'en'
name
=
'English'
native
=
'English'
feature
=
'Feature'
scenario
=
'Scenario'
examples
=
'Examples|Scenarios'
scenario_outline
=
'Scenario Outline'
def
__init__
(
self
,
code
=
None
):
if
not
code
:
return
self
.
code
=
code
for
attr
,
value
in
languages
.
LANGUAGES
[
code
]
.
items
():
setattr
(
self
,
attr
,
value
)
class
StepDefinition
(
object
):
class
StepDefinition
(
object
):
"""A step definition is a wrapper for user-defined callbacks. It
"""A step definition is a wrapper for user-defined callbacks. It
gets a few metadata from file, such as filename and line number"""
gets a few metadata from file, such as filename and line number"""
...
...
lettuce/languages.py
0 → 100644
View file @
40409bac
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010> 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/>.
LANGUAGES
=
{
'en'
:
{
'examples'
:
'Examples|Scenarios'
,
'feature'
:
'Feature'
,
'name'
:
'English'
,
'native'
:
'English'
,
'scenario'
:
'Scenario'
,
'scenario_outline'
:
'Scenario Outline'
,
},
'pt'
:
{
'examples'
:
'Exemplos|Cenários'
,
'feature'
:
'Funcionalidade'
,
'name'
:
'Portuguese'
,
'native'
:
u'Português'
,
'scenario'
:
u'Cenário|Cenario'
,
'scenario_outline'
:
u'Esquema do Cenário|Esquema do Cenario'
,
},
}
tests/functional/test_runner.py
View file @
40409bac
...
@@ -401,7 +401,7 @@ def test_output_with_failed_colorless_with_table():
...
@@ -401,7 +401,7 @@ def test_output_with_failed_colorless_with_table():
" And this one fails # tests/functional/output_features/failed_table/failed_table_steps.py:24
\n
"
" And this one fails # tests/functional/output_features/failed_table/failed_table_steps.py:24
\n
"
"
\033
[A And this one fails # tests/functional/output_features/failed_table/failed_table_steps.py:24
\n
"
"
\033
[A And this one fails # tests/functional/output_features/failed_table/failed_table_steps.py:24
\n
"
" Traceback (most recent call last):
\n
"
" Traceback (most recent call last):
\n
"
' File "
%(lettuce_core_file)
s", line
55
, in __call__
\n
'
' File "
%(lettuce_core_file)
s", line
73
, in __call__
\n
'
" ret = self.function(self.step, *args, **kw)
\n
"
" ret = self.function(self.step, *args, **kw)
\n
"
' File "
%(step_file)
s", line 25, in tof
\n
'
' File "
%(step_file)
s", line 25, in tof
\n
'
" assert False
\n
"
" assert False
\n
"
...
@@ -445,7 +445,7 @@ def test_output_with_failed_colorful_with_table():
...
@@ -445,7 +445,7 @@ def test_output_with_failed_colorful_with_table():
"
\033
[1;30m And this one fails
\033
[1;30m# tests/functional/output_features/failed_table/failed_table_steps.py:24
\033
[0m
\n
"
"
\033
[1;30m And this one fails
\033
[1;30m# tests/functional/output_features/failed_table/failed_table_steps.py:24
\033
[0m
\n
"
"
\033
[A
\033
[0;31m And this one fails
\033
[1;41;33m# tests/functional/output_features/failed_table/failed_table_steps.py:24
\033
[0m
\n
"
"
\033
[A
\033
[0;31m And this one fails
\033
[1;41;33m# tests/functional/output_features/failed_table/failed_table_steps.py:24
\033
[0m
\n
"
"
\033
[1;31m Traceback (most recent call last):
\n
"
"
\033
[1;31m Traceback (most recent call last):
\n
"
' File "
%(lettuce_core_file)
s", line
55
, in __call__
\n
'
' File "
%(lettuce_core_file)
s", line
73
, in __call__
\n
'
" ret = self.function(self.step, *args, **kw)
\n
"
" ret = self.function(self.step, *args, **kw)
\n
"
' File "
%(step_file)
s", line 25, in tof
\n
'
' File "
%(step_file)
s", line 25, in tof
\n
'
" assert False
\n
"
" assert False
\n
"
...
@@ -572,7 +572,7 @@ def test_output_with_failful_outline_colorless():
...
@@ -572,7 +572,7 @@ def test_output_with_failful_outline_colorless():
' | john | doe-1234 | john@gmail.org | Welcome, John |
\n
'
' | john | doe-1234 | john@gmail.org | Welcome, John |
\n
'
' | mary | wee-9876 | mary@email.com | Welcome, Mary |
\n
'
' | mary | wee-9876 | mary@email.com | Welcome, Mary |
\n
'
" Traceback (most recent call last):
\n
"
" Traceback (most recent call last):
\n
"
' File "
%(lettuce_core_file)
s", line
55
, in __call__
\n
'
' File "
%(lettuce_core_file)
s", line
73
, in __call__
\n
'
" ret = self.function(self.step, *args, **kw)
\n
"
" ret = self.function(self.step, *args, **kw)
\n
"
' File "
%(step_file)
s", line 30, in when_i_fill_the_field_x_with_y
\n
'
' File "
%(step_file)
s", line 30, in when_i_fill_the_field_x_with_y
\n
'
" if field == 'password' and value == 'wee-9876': assert False
\n
"
" if field == 'password' and value == 'wee-9876': assert False
\n
"
...
@@ -616,7 +616,7 @@ def test_output_with_failful_outline_colorful():
...
@@ -616,7 +616,7 @@ def test_output_with_failful_outline_colorful():
'
\033
[1;32m
\033
[1;37m |
\033
[1;32m john
\033
[1;37m |
\033
[1;32m doe-1234
\033
[1;37m |
\033
[1;32m john@gmail.org
\033
[1;37m |
\033
[1;32m Welcome, John
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
'
'
\033
[1;32m
\033
[1;37m |
\033
[1;32m john
\033
[1;37m |
\033
[1;32m doe-1234
\033
[1;37m |
\033
[1;32m john@gmail.org
\033
[1;37m |
\033
[1;32m Welcome, John
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
'
'
\033
[1;32m
\033
[1;37m |
\033
[1;32m mary
\033
[1;37m |
\033
[1;32m wee-9876
\033
[1;37m |
\033
[1;32m mary@email.com
\033
[1;37m |
\033
[1;32m Welcome, Mary
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
'
'
\033
[1;32m
\033
[1;37m |
\033
[1;32m mary
\033
[1;37m |
\033
[1;32m wee-9876
\033
[1;37m |
\033
[1;32m mary@email.com
\033
[1;37m |
\033
[1;32m Welcome, Mary
\033
[1;37m |
\033
[1;32m
\033
[0m
\n
'
"
\033
[1;31m Traceback (most recent call last):
\n
"
"
\033
[1;31m Traceback (most recent call last):
\n
"
' File "
%(lettuce_core_file)
s", line
55
, in __call__
\n
'
' File "
%(lettuce_core_file)
s", line
73
, in __call__
\n
'
" ret = self.function(self.step, *args, **kw)
\n
"
" ret = self.function(self.step, *args, **kw)
\n
"
' File "
%(step_file)
s", line 30, in when_i_fill_the_field_x_with_y
\n
'
' File "
%(step_file)
s", line 30, in when_i_fill_the_field_x_with_y
\n
'
" if field == 'password' and value == 'wee-9876': assert False
\n
"
" if field == 'password' and value == 'wee-9876': assert False
\n
"
...
...
tests/unit/test_language.py
0 → 100644
View file @
40409bac
# -*- coding: utf-8 -*-
# <Lettuce - Behaviour Driven Development for python>
# Copyright (C) <2010> 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
nose.tools
import
assert_equals
from
lettuce.core
import
Language
def
test_language_is_english_by_default
():
"Language class is english by default"
lang
=
Language
()
assert_equals
(
lang
.
code
,
'en'
)
assert_equals
(
lang
.
name
,
'English'
)
assert_equals
(
lang
.
native
,
'English'
)
assert_equals
(
lang
.
feature
,
'Feature'
)
assert_equals
(
lang
.
scenario
,
'Scenario'
)
assert_equals
(
lang
.
examples
,
'Examples|Scenarios'
)
assert_equals
(
lang
.
scenario_outline
,
'Scenario Outline'
)
def
test_language_portuguese
():
'Language class supports portuguese through code "pt"'
lang
=
Language
(
'pt'
)
assert_equals
(
lang
.
code
,
'pt'
)
assert_equals
(
lang
.
name
,
'Portuguese'
)
assert_equals
(
lang
.
native
,
u'Português'
)
assert_equals
(
lang
.
feature
,
'Funcionalidade'
)
assert_equals
(
lang
.
scenario
,
u'Cenário|Cenario'
)
assert_equals
(
lang
.
examples
,
'Exemplos|Cenários'
)
assert_equals
(
lang
.
scenario_outline
,
'Esquema do Cenário|Esquema do Cenario'
)
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