本文整理汇总了Python中tests.asserts.assert_equals函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equals函数的具体用法?Python assert_equals怎么用?Python assert_equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_equals函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_output_of_table_with_success_colorless
def test_output_of_table_with_success_colorless():
"""Language: pt-br -> success table colorless"""
with capture_output() as (out, err):
runner = Runner(join_path('pt-br', 'success', 'table.feature'),
verbosity=3)
runner.run()
assert_equals(out.getvalue(),
u"\n"
u"Funcionalidade: feature burra, com tabela # tests/functional/language_specific_features/pt-br/success/table.feature:3\n"
u" Como um programador # tests/functional/language_specific_features/pt-br/success/table.feature:4\n"
u" Eu quero testar steps com tabelas # tests/functional/language_specific_features/pt-br/success/table.feature:5\n"
u" Para ver o output em pt-br # tests/functional/language_specific_features/pt-br/success/table.feature:6\n"
u"\n"
u" #1\n"
u" Cenario: Fazer nada, com tabelas :) # tests/functional/language_specific_features/pt-br/success/table.feature:8\n"
u" Dado que eu brinco com os seguintes itens: # tests/functional/language_specific_features/pt-br/success/table_steps.py:6\n"
u" | id | description |\n"
u" | 12 | some desc |\n"
u" | 64 | another desc |\n"
u"\n"
u" ----------------------------------------------------------------------------\n"
u"\n"
u"1 feature (1 passed)\n"
u"1 scenario (1 passed)\n"
u"1 step (1 passed)\n"
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:28,代码来源:test_ptbr.py
示例2: test_simple_tables_behave_as_feature
def test_simple_tables_behave_as_feature():
"Basic step.behave_as behaviour is working"
with capture_output() as (out, _):
Runner(path_to_feature('2nd_table_steps'), verbosity=3).run()
assert_equals(out.getvalue(),
"\n"
"Feature: Multiplication # tests/functional/behave_as_features/2nd_table_steps/2nd_table_steps.feature:2\n"
" In order to avoid silly mistakes # tests/functional/behave_as_features/2nd_table_steps/2nd_table_steps.feature:3\n"
" Cashiers must be able to multiplicate numbers :) # tests/functional/behave_as_features/2nd_table_steps/2nd_table_steps.feature:4\n"
"\n"
" #1\n"
" Scenario: Regular numbers # tests/functional/behave_as_features/2nd_table_steps/2nd_table_steps.feature:6\n"
" Given I multiply these numbers: # tests/functional/behave_as_features/2nd_table_steps/simple_tables_step_definitions.py:31\n"
" | number |\n"
" | 55 |\n"
" | 2 |\n"
" Then the result should be 110 on the screen # tests/functional/behave_as_features/2nd_table_steps/simple_tables_step_definitions.py:19\n"
"\n"
" ----------------------------------------------------------------------------\n"
"\n"
" #2\n"
" Scenario: Shorter version of the scenario above # tests/functional/behave_as_features/2nd_table_steps/2nd_table_steps.feature:13\n"
" Given I multiply 55 and 2 into the calculator # tests/functional/behave_as_features/2nd_table_steps/simple_tables_step_definitions.py:23\n"
" Then the result should be 110 on the screen # tests/functional/behave_as_features/2nd_table_steps/simple_tables_step_definitions.py:19\n"
"\n"
" ----------------------------------------------------------------------------\n"
"\n"
"1 feature (1 passed)\n"
"2 scenarios (2 passed)\n"
"4 steps (4 passed)\n"
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:33,代码来源:test_behave_as_handling.py
示例3: test_output_of_table_with_success_colorless
def test_output_of_table_with_success_colorless():
"""Language: ja -> success table colorless"""
with capture_output() as (out, err):
runner = Runner(join_path('ja', 'success', 'table.feature'),
verbosity=3)
runner.run()
assert_equals(out.getvalue(),
u"\n"
u"フィーチャ: テーブル記法 # tests/functional/language_specific_features/ja/success/table.feature:3\n"
u" 日本語でのテーブル記法がパスするかのテスト # tests/functional/language_specific_features/ja/success/table.feature:4\n"
u"\n"
u" #1\n"
u" シナリオ: 何もしないテーブル # tests/functional/language_specific_features/ja/success/table.feature:6\n"
u" 前提 データは以下: # tests/functional/language_specific_features/ja/success/table_steps.py:6\n"
u" | id | 定義 |\n"
u" | 12 | 何かの定義 |\n"
u" | 64 | 別の定義 |\n"
u"\n"
u" ----------------------------------------------------------------------------\n"
u"\n"
u"1 feature (1 passed)\n"
u"1 scenario (1 passed)\n"
u"1 step (1 passed)\n"
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:26,代码来源:test_ja.py
示例4: test_output_of_table_with_success_colorless
def test_output_of_table_with_success_colorless():
"""Language: fr -> sucess table colorless"""
with capture_output() as (out, err):
runner = Runner(join_path('fr', 'success', 'table.feature'), verbosity=3)
runner.run()
assert_equals(out.getvalue(), u"""
Fonctionnalité: Test des sorties, avec table # tests/functional/language_specific_features/fr/success/table.feature:4
En tant que programmeur # tests/functional/language_specific_features/fr/success/table.feature:5
Je veux tester les sorties de scénario avec table # tests/functional/language_specific_features/fr/success/table.feature:6
#1
Scénario: NE rien faire, mais avec des tables # tests/functional/language_specific_features/fr/success/table.feature:8
Soit les éléments suivant # tests/functional/language_specific_features/fr/success/table_steps.py:6
| id | élément |
| 50 | Un |
| 59 | 42 |
| 29 | sieste |
----------------------------------------------------------------------------
1 feature (1 passed)
1 scenario (1 passed)
1 step (1 passed)
""")
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:26,代码来源:test_fr.py
示例5: test_django_admin_media_serving_forced_by_setting
def test_django_admin_media_serving_forced_by_setting():
'settings.LETTUCE_SERVE_ADMIN_MEDIA forces lettuce to serve admin assets'
os.environ['PYTHONPATH'] = "%s:%s" % (
FileSystem.join(lib_directory, 'Django-1.3'),
OLD_PYTHONPATH,
)
FileSystem.pushd(current_directory, "django", "grocery")
extra_args = " --scenarios=1,3,4,5 --settings=settings_without_admin"
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=2 ./features/ %s" % extra_args)
assert_equals(status, 0, out)
FileSystem.popd()
lines = out.splitlines()
assert u"Preparing to serve django's admin site static files " \
"(as per settings.LETTUCE_SERVE_ADMIN_MEDIA=True)..." in lines
assert u'Running on port 7000 ... OK' in lines
assert u'Fetching static files ... OK' in lines
assert u'Fetching CSS files: ... OK' in lines
assert u'Fetching javascript files: ... OK' in lines
assert u"Django's builtin server is running at 0.0.0.0:7000" in lines
# the scenario 2 is not suppose to run
assert u'Fetching admin media ... OK' not in lines
开发者ID:benoitbryon,项目名称:lettuce,代码行数:30,代码来源:test_grocery.py
示例6: test_output_with_success_colorless
def test_output_with_success_colorless():
"""Language: pt-br -> success colorless"""
with capture_output() as (out, err):
runner = Runner(join_path('pt-br', 'success', 'dumb.feature'),
verbosity=3)
runner.run()
assert_equals(out.getvalue(),
u"\n"
u"Funcionalidade: feature burra # tests/functional/language_specific_features/pt-br/success/dumb.feature:3\n"
u" Como um programador # tests/functional/language_specific_features/pt-br/success/dumb.feature:4\n"
u" Eu quero que este teste passe # tests/functional/language_specific_features/pt-br/success/dumb.feature:5\n"
u" Para testar um cenário de sucesso # tests/functional/language_specific_features/pt-br/success/dumb.feature:6\n"
u"\n"
u" #1\n"
u" Cenario: Fazer nada # tests/functional/language_specific_features/pt-br/success/dumb.feature:8\n"
u" Dado que eu faço nada # tests/functional/language_specific_features/pt-br/success/dumb_steps.py:6\n"
u"\n"
u" ----------------------------------------------------------------------------\n"
u"\n"
u"1 feature (1 passed)\n"
u"1 scenario (1 passed)\n"
u"1 step (1 passed)\n"
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:25,代码来源:test_ptbr.py
示例7: test_django_admin_media_serving_on_django_125
def test_django_admin_media_serving_on_django_125():
'lettuce should serve admin static files properly on Django 1.2.5'
os.environ['PYTHONPATH'] = "%s:%s" % (
FileSystem.join(lib_directory, 'Django-1.2.5'),
OLD_PYTHONPATH,
)
FileSystem.pushd(current_directory, "django", "grocery")
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=2 ./features/")
assert_equals(status, 0, out)
FileSystem.popd()
lines = out.splitlines()
f = '\n\n'
f += '*' * 100
f += '\n' + '\n'.join(lines)
assert u"Preparing to serve django's admin site static files..." in lines, f
assert u"Django's builtin server is running at 0.0.0.0:7000" in lines, f
assert u'Running on port 7000 ... OK' in lines, f
assert u'Fetching admin media ... OK' in lines, f
assert u'Fetching static files ... OK' in lines, f
assert u'Fetching CSS files: ... OK' in lines, f
assert u'Fetching javascript files: ... OK' in lines, f
开发者ID:benoitbryon,项目名称:lettuce,代码行数:27,代码来源:test_grocery.py
示例8: test_assert_equals_fails_as_expected
def test_assert_equals_fails_as_expected():
"""
Test assert_equals fails as expected
"""
raise SkipTest("broken")
original = """1234
1234
456790"""
expected = """1234
1234
4567890"""
def assert_with_stream():
stream = StringIO()
asserts.assert_equals(original, expected, stream=stream)
assert_raises(AssertionError, assert_with_stream)
print stream.getvalue()
expected = """{t.white} {t.normal}{t.white}1234{t.normal}
{t.white} {t.normal}{t.white}1234{t.normal}
{t.red}- {t.normal}{t.red}456790{t.normal}
{t.green}+ {t.normal}{t.green}4567{t.normal}{t.black_on_green}8{t.normal}{t.green}90{t.normal}
""".format(t=term)
print expected
asserts.assert_equals(stream.getvalue(), expected)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:32,代码来源:test_asserts.py
示例9: test_output_outlines_success_colorless
def test_output_outlines_success_colorless():
"""Language: ru -> success outlines colorless"""
with capture_output() as (out, err):
runner = Runner(join_path("ru", "success", "outlines.feature"), verbosity=3)
runner.run()
raise SkipTest("broken")
assert_equals(
out.getvalue(),
u"""
Функционал: Проверить вывод структурного сценария # tests/functional/language_specific_features/ru/success/outlines.feature:3
Как программист # tests/functional/language_specific_features/ru/success/outlines.feature:4
Для того чобы lettuce был надежным # tests/functional/language_specific_features/ru/success/outlines.feature:5
Я хочу, что бы сценарии со структурой работали на русском # tests/functional/language_specific_features/ru/success/outlines.feature:6
Структура сценария: Заполнить форму # tests/functional/language_specific_features/ru/success/outlines.feature:8
Пускай я открываю в браузере "http://sona-studio.com/contacts/" # tests/functional/language_specific_features/ru/success/outlines_steps.py:12
Когда я заполняю в поле "Имя" "<имя>" # tests/functional/language_specific_features/ru/success/outlines_steps.py:16
И я заполняю в поле "Email" "<email>" # tests/functional/language_specific_features/ru/success/outlines_steps.py:24
И я заполняю в поле "Сообщение" "<сообщение>" # tests/functional/language_specific_features/ru/success/outlines_steps.py:32
И я нажимаю "Отправить" # tests/functional/language_specific_features/ru/success/outlines_steps.py:40
Тогда я получаю сообщение "Спасибо за ваше сообщение" # tests/functional/language_specific_features/ru/success/outlines_steps.py:43
Примеры:
| имя | email | сообщение |
| Виталий Игоревич | [email protected] | Есть интересный проект, нужно обсудить |
| Марина Банраул | [email protected] | Мне нравятся ваши дизайны, хочу сайт |
1 feature (1 passed)
2 scenarios (2 passed)
12 steps (12 passed)
""",
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:35,代码来源:test_ru.py
示例10: test_output_of_table_with_success_colorless
def test_output_of_table_with_success_colorless():
"""Language: ru -> success table colorless"""
with capture_output() as (out, err):
runner = Runner(join_path("ru", "success", "table.feature"), verbosity=3)
runner.run()
assert_equals(
out.getvalue(),
u"\n"
u"Функционал: фича с табличкой # tests/functional/language_specific_features/ru/success/table.feature:3\n"
u" Для того, что бы lettuce был надежным # tests/functional/language_specific_features/ru/success/table.feature:4\n"
u" Как программист # tests/functional/language_specific_features/ru/success/table.feature:5\n"
u" Я хочу, что бы тесты с таблицами работали отлично и на русском # tests/functional/language_specific_features/ru/success/table.feature:6\n"
u"\n"
u" #1\n"
u" Сценарий: Проверить таблички # tests/functional/language_specific_features/ru/success/table.feature:8\n"
u" Когда Пускай имеем таблицу пациентов: # tests/functional/language_specific_features/ru/success/table_steps.py:5\n"
u" | ФИО | Диагноз |\n"
u" | Петров ПП | диарея |\n"
u" | Сидоров НА | хронический снобизм |\n"
u"\n"
u" ----------------------------------------------------------------------------\n"
u"\n"
u"1 feature (1 passed)\n"
u"1 scenario (1 passed)\n"
u"1 step (1 passed)\n",
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:28,代码来源:test_ru.py
示例11: test_output_with_success_colorless
def test_output_with_success_colorless():
"""Language: ru -> success colorless"""
with capture_output() as (out, err):
runner = Runner(join_path("ru", "success", "dumb.feature"), verbosity=3)
runner.run()
assert_equals(
out.getvalue(),
u"\n"
u"Функционал: тупая фича # tests/functional/language_specific_features/ru/success/dumb.feature:3\n"
u" Чтобы lettuce был более надежным # tests/functional/language_specific_features/ru/success/dumb.feature:4\n"
u" Как программист # tests/functional/language_specific_features/ru/success/dumb.feature:5\n"
u" Я хочу что бы тест был зеленый # tests/functional/language_specific_features/ru/success/dumb.feature:6\n"
u"\n"
u" #1\n"
u" Сценарий: Ничего не делать # tests/functional/language_specific_features/ru/success/dumb.feature:8\n"
u" Когда Пуская я ничего не делаю # tests/functional/language_specific_features/ru/success/dumb_steps.py:6\n"
u" Тогда я вижу что тест выполняется # tests/functional/language_specific_features/ru/success/dumb_steps.py:10\n"
u"\n"
u" ----------------------------------------------------------------------------\n"
u"\n"
u"1 feature (1 passed)\n"
u"1 scenario (1 passed)\n"
u"2 steps (2 passed)\n",
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:26,代码来源:test_ru.py
示例12: test_output_with_success_colorless
def test_output_with_success_colorless():
"""
Language: fr -> success colorless
"""
with capture_output() as (out, err):
runner = Runner(join_path('fr', 'success', 'dumb.feature'),
verbosity=3)
runner.run()
assert_equals(out.getvalue(), u"""
Fonctionnalité: Test complet # tests/functional/language_specific_features/fr/success/dumb.feature:3
En tant que programmeur # tests/functional/language_specific_features/fr/success/dumb.feature:4
Je veux valider les tests # tests/functional/language_specific_features/fr/success/dumb.feature:5
#1
Scénario: On ne fait rien # tests/functional/language_specific_features/fr/success/dumb.feature:7
Quand je ne fait rien # tests/functional/language_specific_features/fr/success/dumb_steps.py:6
----------------------------------------------------------------------------
1 feature (1 passed)
1 scenario (1 passed)
1 step (1 passed)
""")
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:25,代码来源:test_fr.py
示例13: test_simple_behave_as_feature
def test_simple_behave_as_feature():
"""
Basic step.behave_as behaviour is working
"""
with capture_output() as (out, _):
Runner(path_to_feature('1st_normal_steps'), verbosity=3).run()
assert_equals(out.getvalue(),
"\n"
"Feature: Multiplication # tests/functional/behave_as_features/1st_normal_steps/1st_normal_steps.feature:2\n"
" In order to avoid silly mistakes # tests/functional/behave_as_features/1st_normal_steps/1st_normal_steps.feature:3\n"
" Cashiers must be able to multiplicate numbers :) # tests/functional/behave_as_features/1st_normal_steps/1st_normal_steps.feature:4\n"
"\n"
" #1\n"
" Scenario: Regular numbers # tests/functional/behave_as_features/1st_normal_steps/1st_normal_steps.feature:6\n"
" Given I have entered 10 into the calculator # tests/functional/behave_as_features/1st_normal_steps/simple_step_definitions.py:11\n"
" And I have entered 4 into the calculator # tests/functional/behave_as_features/1st_normal_steps/simple_step_definitions.py:11\n"
" When I press multiply # tests/functional/behave_as_features/1st_normal_steps/simple_step_definitions.py:15\n"
" Then the result should be 40 on the screen # tests/functional/behave_as_features/1st_normal_steps/simple_step_definitions.py:19\n"
"\n"
" ----------------------------------------------------------------------------\n"
"\n"
" #2\n"
" Scenario: Shorter version of the scenario above # tests/functional/behave_as_features/1st_normal_steps/1st_normal_steps.feature:12\n"
" Given I multiply 10 and 4 into the calculator # tests/functional/behave_as_features/1st_normal_steps/simple_step_definitions.py:23\n"
" Then the result should be 40 on the screen # tests/functional/behave_as_features/1st_normal_steps/simple_step_definitions.py:19\n"
"\n"
" ----------------------------------------------------------------------------\n"
"\n"
"1 feature (1 passed)\n"
"2 scenarios (2 passed)\n"
"6 steps (6 passed)\n"
)
开发者ID:raitisdembovskis,项目名称:lettuce,代码行数:34,代码来源:test_behave_as_handling.py
示例14: test_no_server
def test_no_server():
'"harvest" --no-server does not start the server'
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=3 --no-color --apps=foobar --no-server")
assert_equals(status, 0, out)
assert "Django's builtin server is running at" not in out
开发者ID:MishaUliutin,项目名称:lettuce,代码行数:8,代码来源:test_alfaces.py
示例15: test_no_server
def test_no_server():
'"harvest" --no-server does not start the server'
status, out = subprocess.getstatusoutput(
"%s manage.py harvest --verbosity=3 --apps=foobar --no-server" % (python_path,))
assert_equals(status, 0, out)
assert "Django's builtin server is running at" not in out
开发者ID:rpaloschi,项目名称:lettuce,代码行数:8,代码来源:test_alfaces.py
示例16: test_limit_by_app_getting_one_app
def test_limit_by_app_getting_one_app():
'running "harvest" with --apps=one_app'
status, out = subprocess.getstatusoutput(
"%s manage.py harvest --verbosity=3 --apps=foobar" % (python_path,))
assert_equals(status, 0, out)
assert "Test the django app DO NOTHING" not in out
assert "Test the django app FOO BAR" in out
开发者ID:rpaloschi,项目名称:lettuce,代码行数:9,代码来源:test_alfaces.py
示例17: test_no_server
def test_no_server():
'"harvest" --no-server does not start the server'
FileSystem.pushd(current_directory, "django", "alfaces")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=3 --apps=foobar --no-server")
assert_equals(status, 0, out)
assert "Django's builtin server is running at" not in out
开发者ID:DominikGuzei,项目名称:lettuce,代码行数:9,代码来源:test_alfaces.py
示例18: test_excluding_app
def test_excluding_app():
'running "harvest" with --avoid-apps=one_app'
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=3 --no-color --avoid-apps=donothing")
assert_equals(status, 0, out)
assert "Test the django app DO NOTHING" not in out
assert "Test the django app FOO BAR" in out
开发者ID:MishaUliutin,项目名称:lettuce,代码行数:9,代码来源:test_alfaces.py
示例19: test_excluding_apps_separated_by_comma
def test_excluding_apps_separated_by_comma():
'running "harvest" with --avoid-apps=multiple,apps'
status, out = commands.getstatusoutput(
"python manage.py harvest --verbosity=3 --no-color --avoid-apps=donothing,foobar")
assert_equals(status, 0, out)
assert "Test the django app DO NOTHING" not in out
assert "Test the django app FOO BAR" not in out
开发者ID:MishaUliutin,项目名称:lettuce,代码行数:9,代码来源:test_alfaces.py
示例20: test_django_agains_alfaces
def test_django_agains_alfaces():
'running the "harvest" django command with verbosity 3'
FileSystem.pushd(current_directory, "django", "alfaces")
status, out = commands.getstatusoutput("python manage.py harvest --verbosity=3")
assert_equals(status, 0)
FileSystem.popd()
开发者ID:emanuell,项目名称:lettuce,代码行数:9,代码来源:test_alfaces.py
注:本文中的tests.asserts.assert_equals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论