busser-behave 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.cane +0 -0
- data/.gitignore +17 -0
- data/.tailor +4 -0
- data/.travis.yml +11 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE +15 -0
- data/README.md +41 -0
- data/Rakefile +68 -0
- data/busser-behave.gemspec +30 -0
- data/features/plugin_install_command.feature +11 -0
- data/features/plugin_list_command.feature +8 -0
- data/features/support/env.rb +13 -0
- data/features/test_command.feature +31 -0
- data/lib/busser/behave/version.rb +26 -0
- data/lib/busser/runner_plugin/behave.rb +37 -0
- data/vendor/behave/CHANGES.rst +483 -0
- data/vendor/behave/LICENSE +23 -0
- data/vendor/behave/MANIFEST.in +37 -0
- data/vendor/behave/PROJECT_INFO.rst +21 -0
- data/vendor/behave/README.rst +112 -0
- data/vendor/behave/VERSION.txt +1 -0
- data/vendor/behave/behave.ini +22 -0
- data/vendor/behave/behave/__init__.py +30 -0
- data/vendor/behave/behave/__main__.py +187 -0
- data/vendor/behave/behave/_stepimport.py +185 -0
- data/vendor/behave/behave/_types.py +134 -0
- data/vendor/behave/behave/api/__init__.py +7 -0
- data/vendor/behave/behave/api/async_step.py +283 -0
- data/vendor/behave/behave/capture.py +227 -0
- data/vendor/behave/behave/compat/__init__.py +5 -0
- data/vendor/behave/behave/compat/collections.py +20 -0
- data/vendor/behave/behave/configuration.py +788 -0
- data/vendor/behave/behave/contrib/__init__.py +0 -0
- data/vendor/behave/behave/contrib/scenario_autoretry.py +73 -0
- data/vendor/behave/behave/formatter/__init__.py +12 -0
- data/vendor/behave/behave/formatter/_builtins.py +39 -0
- data/vendor/behave/behave/formatter/_registry.py +135 -0
- data/vendor/behave/behave/formatter/ansi_escapes.py +91 -0
- data/vendor/behave/behave/formatter/base.py +200 -0
- data/vendor/behave/behave/formatter/formatters.py +57 -0
- data/vendor/behave/behave/formatter/json.py +253 -0
- data/vendor/behave/behave/formatter/null.py +12 -0
- data/vendor/behave/behave/formatter/plain.py +158 -0
- data/vendor/behave/behave/formatter/pretty.py +351 -0
- data/vendor/behave/behave/formatter/progress.py +287 -0
- data/vendor/behave/behave/formatter/rerun.py +114 -0
- data/vendor/behave/behave/formatter/sphinx_steps.py +372 -0
- data/vendor/behave/behave/formatter/sphinx_util.py +118 -0
- data/vendor/behave/behave/formatter/steps.py +497 -0
- data/vendor/behave/behave/formatter/tags.py +178 -0
- data/vendor/behave/behave/i18n.py +614 -0
- data/vendor/behave/behave/importer.py +102 -0
- data/vendor/behave/behave/json_parser.py +264 -0
- data/vendor/behave/behave/log_capture.py +233 -0
- data/vendor/behave/behave/matchers.py +402 -0
- data/vendor/behave/behave/model.py +1737 -0
- data/vendor/behave/behave/model_core.py +416 -0
- data/vendor/behave/behave/model_describe.py +105 -0
- data/vendor/behave/behave/parser.py +615 -0
- data/vendor/behave/behave/reporter/__init__.py +0 -0
- data/vendor/behave/behave/reporter/base.py +45 -0
- data/vendor/behave/behave/reporter/junit.py +473 -0
- data/vendor/behave/behave/reporter/summary.py +94 -0
- data/vendor/behave/behave/runner.py +753 -0
- data/vendor/behave/behave/runner_util.py +417 -0
- data/vendor/behave/behave/step_registry.py +112 -0
- data/vendor/behave/behave/tag_expression.py +111 -0
- data/vendor/behave/behave/tag_matcher.py +465 -0
- data/vendor/behave/behave/textutil.py +137 -0
- data/vendor/behave/behave/userdata.py +130 -0
- data/vendor/behave/behave4cmd0/__all_steps__.py +12 -0
- data/vendor/behave/behave4cmd0/__init__.py +5 -0
- data/vendor/behave/behave4cmd0/__setup.py +11 -0
- data/vendor/behave/behave4cmd0/command_shell.py +216 -0
- data/vendor/behave/behave4cmd0/command_shell_proc.py +256 -0
- data/vendor/behave/behave4cmd0/command_steps.py +532 -0
- data/vendor/behave/behave4cmd0/command_util.py +147 -0
- data/vendor/behave/behave4cmd0/failing_steps.py +49 -0
- data/vendor/behave/behave4cmd0/log/__init__.py +1 -0
- data/vendor/behave/behave4cmd0/log/steps.py +395 -0
- data/vendor/behave/behave4cmd0/note_steps.py +29 -0
- data/vendor/behave/behave4cmd0/passing_steps.py +36 -0
- data/vendor/behave/behave4cmd0/pathutil.py +146 -0
- data/vendor/behave/behave4cmd0/setup_command_shell.py +24 -0
- data/vendor/behave/behave4cmd0/textutil.py +304 -0
- data/vendor/behave/bin/behave +44 -0
- data/vendor/behave/bin/behave.cmd +10 -0
- data/vendor/behave/bin/behave.junit_filter.py +85 -0
- data/vendor/behave/bin/behave.step_durations.py +163 -0
- data/vendor/behave/bin/behave2cucumber_json.py +63 -0
- data/vendor/behave/bin/behave_cmd.py +44 -0
- data/vendor/behave/bin/convert_i18n_yaml.py +77 -0
- data/vendor/behave/bin/explore_platform_encoding.py +24 -0
- data/vendor/behave/bin/i18n.yml +621 -0
- data/vendor/behave/bin/invoke +8 -0
- data/vendor/behave/bin/invoke.cmd +9 -0
- data/vendor/behave/bin/json.format.py +167 -0
- data/vendor/behave/bin/jsonschema_validate.py +122 -0
- data/vendor/behave/bin/make_localpi.py +279 -0
- data/vendor/behave/bin/project_bootstrap.sh +30 -0
- data/vendor/behave/bin/toxcmd.py +270 -0
- data/vendor/behave/bin/toxcmd3.py +270 -0
- data/vendor/behave/conftest.py +27 -0
- data/vendor/behave/docs/Makefile +154 -0
- data/vendor/behave/docs/_static/agogo.css +501 -0
- data/vendor/behave/docs/_static/behave_logo.png +0 -0
- data/vendor/behave/docs/_static/behave_logo1.png +0 -0
- data/vendor/behave/docs/_static/behave_logo2.png +0 -0
- data/vendor/behave/docs/_static/behave_logo3.png +0 -0
- data/vendor/behave/docs/_themes/LICENSE +45 -0
- data/vendor/behave/docs/_themes/kr/layout.html +17 -0
- data/vendor/behave/docs/_themes/kr/relations.html +19 -0
- data/vendor/behave/docs/_themes/kr/static/flasky.css_t +480 -0
- data/vendor/behave/docs/_themes/kr/static/small_flask.css +90 -0
- data/vendor/behave/docs/_themes/kr/theme.conf +7 -0
- data/vendor/behave/docs/_themes/kr_small/layout.html +22 -0
- data/vendor/behave/docs/_themes/kr_small/static/flasky.css_t +287 -0
- data/vendor/behave/docs/_themes/kr_small/theme.conf +10 -0
- data/vendor/behave/docs/api.rst +408 -0
- data/vendor/behave/docs/appendix.rst +19 -0
- data/vendor/behave/docs/behave.rst +640 -0
- data/vendor/behave/docs/behave.rst-template +86 -0
- data/vendor/behave/docs/behave_ecosystem.rst +81 -0
- data/vendor/behave/docs/comparison.rst +85 -0
- data/vendor/behave/docs/conf.py +293 -0
- data/vendor/behave/docs/context_attributes.rst +66 -0
- data/vendor/behave/docs/django.rst +192 -0
- data/vendor/behave/docs/formatters.rst +61 -0
- data/vendor/behave/docs/gherkin.rst +673 -0
- data/vendor/behave/docs/index.rst +57 -0
- data/vendor/behave/docs/install.rst +60 -0
- data/vendor/behave/docs/more_info.rst +184 -0
- data/vendor/behave/docs/new_and_noteworthy.rst +18 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.4.rst +11 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.5.rst +814 -0
- data/vendor/behave/docs/new_and_noteworthy_v1.2.6.rst +255 -0
- data/vendor/behave/docs/parse_builtin_types.rst +59 -0
- data/vendor/behave/docs/philosophy.rst +235 -0
- data/vendor/behave/docs/regular_expressions.rst +71 -0
- data/vendor/behave/docs/related.rst +14 -0
- data/vendor/behave/docs/test_domains.rst +62 -0
- data/vendor/behave/docs/tutorial.rst +636 -0
- data/vendor/behave/docs/update_behave_rst.py +100 -0
- data/vendor/behave/etc/json/behave.json-schema +172 -0
- data/vendor/behave/etc/junit.xml/behave_junit.xsd +103 -0
- data/vendor/behave/etc/junit.xml/junit-4.xsd +92 -0
- data/vendor/behave/examples/async_step/README.txt +8 -0
- data/vendor/behave/examples/async_step/behave.ini +14 -0
- data/vendor/behave/examples/async_step/features/async_dispatch.feature +8 -0
- data/vendor/behave/examples/async_step/features/async_run.feature +6 -0
- data/vendor/behave/examples/async_step/features/environment.py +28 -0
- data/vendor/behave/examples/async_step/features/steps/async_dispatch_steps.py +26 -0
- data/vendor/behave/examples/async_step/features/steps/async_steps34.py +10 -0
- data/vendor/behave/examples/async_step/features/steps/async_steps35.py +10 -0
- data/vendor/behave/examples/async_step/testrun_example.async_dispatch.txt +11 -0
- data/vendor/behave/examples/async_step/testrun_example.async_run.txt +9 -0
- data/vendor/behave/examples/env_vars/README.rst +26 -0
- data/vendor/behave/examples/env_vars/behave.ini +15 -0
- data/vendor/behave/examples/env_vars/behave_run.output_example.txt +12 -0
- data/vendor/behave/examples/env_vars/features/env_var.feature +6 -0
- data/vendor/behave/examples/env_vars/features/steps/env_var_steps.py +38 -0
- data/vendor/behave/features/README.txt +12 -0
- data/vendor/behave/features/background.feature +392 -0
- data/vendor/behave/features/capture_stderr.feature +172 -0
- data/vendor/behave/features/capture_stdout.feature +125 -0
- data/vendor/behave/features/cmdline.lang_list.feature +33 -0
- data/vendor/behave/features/configuration.default_paths.feature +116 -0
- data/vendor/behave/features/context.global_params.feature +35 -0
- data/vendor/behave/features/context.local_params.feature +17 -0
- data/vendor/behave/features/directory_layout.advanced.feature +147 -0
- data/vendor/behave/features/directory_layout.basic.feature +75 -0
- data/vendor/behave/features/directory_layout.basic2.feature +87 -0
- data/vendor/behave/features/environment.py +53 -0
- data/vendor/behave/features/exploratory_testing.with_table.feature +141 -0
- data/vendor/behave/features/feature.description.feature +0 -0
- data/vendor/behave/features/feature.exclude_from_run.feature +96 -0
- data/vendor/behave/features/formatter.help.feature +30 -0
- data/vendor/behave/features/formatter.json.feature +420 -0
- data/vendor/behave/features/formatter.progress3.feature +235 -0
- data/vendor/behave/features/formatter.rerun.feature +296 -0
- data/vendor/behave/features/formatter.steps.feature +181 -0
- data/vendor/behave/features/formatter.steps_catalog.feature +100 -0
- data/vendor/behave/features/formatter.steps_doc.feature +140 -0
- data/vendor/behave/features/formatter.steps_usage.feature +404 -0
- data/vendor/behave/features/formatter.tags.feature +134 -0
- data/vendor/behave/features/formatter.tags_location.feature +183 -0
- data/vendor/behave/features/formatter.user_defined.feature +196 -0
- data/vendor/behave/features/i18n.unicode_problems.feature +445 -0
- data/vendor/behave/features/logcapture.clear_handlers.feature +114 -0
- data/vendor/behave/features/logcapture.feature +188 -0
- data/vendor/behave/features/logcapture.filter.feature +130 -0
- data/vendor/behave/features/logging.no_capture.feature +99 -0
- data/vendor/behave/features/logging.setup_format.feature +157 -0
- data/vendor/behave/features/logging.setup_level.feature +168 -0
- data/vendor/behave/features/logging.setup_with_configfile.feature +137 -0
- data/vendor/behave/features/parser.background.sad_cases.feature +129 -0
- data/vendor/behave/features/parser.feature.sad_cases.feature +144 -0
- data/vendor/behave/features/runner.abort_by_user.feature +305 -0
- data/vendor/behave/features/runner.continue_after_failed_step.feature +136 -0
- data/vendor/behave/features/runner.default_format.feature +175 -0
- data/vendor/behave/features/runner.dry_run.feature +184 -0
- data/vendor/behave/features/runner.feature_listfile.feature +223 -0
- data/vendor/behave/features/runner.hook_errors.feature +382 -0
- data/vendor/behave/features/runner.multiple_formatters.feature +285 -0
- data/vendor/behave/features/runner.scenario_autoretry.feature +131 -0
- data/vendor/behave/features/runner.select_files_by_regexp.example.feature +71 -0
- data/vendor/behave/features/runner.select_files_by_regexp.feature +84 -0
- data/vendor/behave/features/runner.select_scenarios_by_file_location.feature +403 -0
- data/vendor/behave/features/runner.select_scenarios_by_name.feature +289 -0
- data/vendor/behave/features/runner.select_scenarios_by_tag.feature +225 -0
- data/vendor/behave/features/runner.stop_after_failure.feature +122 -0
- data/vendor/behave/features/runner.tag_logic.feature +67 -0
- data/vendor/behave/features/runner.unknown_formatter.feature +23 -0
- data/vendor/behave/features/runner.use_stage_implementations.feature +126 -0
- data/vendor/behave/features/scenario.description.feature +171 -0
- data/vendor/behave/features/scenario.exclude_from_run.feature +217 -0
- data/vendor/behave/features/scenario_outline.basics.feature +100 -0
- data/vendor/behave/features/scenario_outline.improved.feature +177 -0
- data/vendor/behave/features/scenario_outline.name_annotation.feature +157 -0
- data/vendor/behave/features/scenario_outline.parametrized.feature +401 -0
- data/vendor/behave/features/scenario_outline.tagged_examples.feature +118 -0
- data/vendor/behave/features/step.async_steps.feature +225 -0
- data/vendor/behave/features/step.duplicated_step.feature +106 -0
- data/vendor/behave/features/step.execute_steps.feature +59 -0
- data/vendor/behave/features/step.execute_steps.with_table.feature +65 -0
- data/vendor/behave/features/step.import_other_step_module.feature +103 -0
- data/vendor/behave/features/step.pending_steps.feature +128 -0
- data/vendor/behave/features/step.undefined_steps.feature +307 -0
- data/vendor/behave/features/step.use_step_library.feature +44 -0
- data/vendor/behave/features/step_dialect.generic_steps.feature +189 -0
- data/vendor/behave/features/step_dialect.given_when_then.feature +89 -0
- data/vendor/behave/features/step_param.builtin_types.with_float.feature +239 -0
- data/vendor/behave/features/step_param.builtin_types.with_integer.feature +305 -0
- data/vendor/behave/features/step_param.custom_types.feature +134 -0
- data/vendor/behave/features/steps/behave_active_tags_steps.py +86 -0
- data/vendor/behave/features/steps/behave_context_steps.py +67 -0
- data/vendor/behave/features/steps/behave_model_tag_logic_steps.py +105 -0
- data/vendor/behave/features/steps/behave_model_util.py +105 -0
- data/vendor/behave/features/steps/behave_select_files_steps.py +83 -0
- data/vendor/behave/features/steps/behave_tag_expression_steps.py +166 -0
- data/vendor/behave/features/steps/behave_undefined_steps.py +101 -0
- data/vendor/behave/features/steps/use_steplib_behave4cmd.py +12 -0
- data/vendor/behave/features/summary.undefined_steps.feature +114 -0
- data/vendor/behave/features/tags.active_tags.feature +385 -0
- data/vendor/behave/features/tags.default_tags.feature +104 -0
- data/vendor/behave/features/tags.tag_expression.feature +105 -0
- data/vendor/behave/features/userdata.feature +331 -0
- data/vendor/behave/invoke.yaml +21 -0
- data/vendor/behave/issue.features/README.txt +17 -0
- data/vendor/behave/issue.features/environment.py +97 -0
- data/vendor/behave/issue.features/issue0030.feature +21 -0
- data/vendor/behave/issue.features/issue0031.feature +16 -0
- data/vendor/behave/issue.features/issue0032.feature +28 -0
- data/vendor/behave/issue.features/issue0035.feature +74 -0
- data/vendor/behave/issue.features/issue0040.feature +154 -0
- data/vendor/behave/issue.features/issue0041.feature +135 -0
- data/vendor/behave/issue.features/issue0042.feature +230 -0
- data/vendor/behave/issue.features/issue0044.feature +51 -0
- data/vendor/behave/issue.features/issue0046.feature +77 -0
- data/vendor/behave/issue.features/issue0052.feature +66 -0
- data/vendor/behave/issue.features/issue0059.feature +29 -0
- data/vendor/behave/issue.features/issue0063.feature +102 -0
- data/vendor/behave/issue.features/issue0064.feature +97 -0
- data/vendor/behave/issue.features/issue0065.feature +18 -0
- data/vendor/behave/issue.features/issue0066.feature +80 -0
- data/vendor/behave/issue.features/issue0067.feature +90 -0
- data/vendor/behave/issue.features/issue0069.feature +64 -0
- data/vendor/behave/issue.features/issue0072.feature +32 -0
- data/vendor/behave/issue.features/issue0073.feature +228 -0
- data/vendor/behave/issue.features/issue0075.feature +18 -0
- data/vendor/behave/issue.features/issue0077.feature +89 -0
- data/vendor/behave/issue.features/issue0080.feature +49 -0
- data/vendor/behave/issue.features/issue0081.feature +138 -0
- data/vendor/behave/issue.features/issue0083.feature +69 -0
- data/vendor/behave/issue.features/issue0084.feature +69 -0
- data/vendor/behave/issue.features/issue0085.feature +119 -0
- data/vendor/behave/issue.features/issue0092.feature +66 -0
- data/vendor/behave/issue.features/issue0096.feature +173 -0
- data/vendor/behave/issue.features/issue0099.feature +130 -0
- data/vendor/behave/issue.features/issue0109.feature +60 -0
- data/vendor/behave/issue.features/issue0111.feature +53 -0
- data/vendor/behave/issue.features/issue0112.feature +64 -0
- data/vendor/behave/issue.features/issue0114.feature +118 -0
- data/vendor/behave/issue.features/issue0116.feature +71 -0
- data/vendor/behave/issue.features/issue0125.feature +49 -0
- data/vendor/behave/issue.features/issue0127.feature +64 -0
- data/vendor/behave/issue.features/issue0139.feature +67 -0
- data/vendor/behave/issue.features/issue0142.feature +37 -0
- data/vendor/behave/issue.features/issue0143.feature +54 -0
- data/vendor/behave/issue.features/issue0145.feature +63 -0
- data/vendor/behave/issue.features/issue0148.feature +105 -0
- data/vendor/behave/issue.features/issue0152.feature +52 -0
- data/vendor/behave/issue.features/issue0159.feature +74 -0
- data/vendor/behave/issue.features/issue0162.feature +86 -0
- data/vendor/behave/issue.features/issue0171.feature +16 -0
- data/vendor/behave/issue.features/issue0172.feature +51 -0
- data/vendor/behave/issue.features/issue0175.feature +91 -0
- data/vendor/behave/issue.features/issue0177.feature +40 -0
- data/vendor/behave/issue.features/issue0181.feature +36 -0
- data/vendor/behave/issue.features/issue0184.feature +144 -0
- data/vendor/behave/issue.features/issue0186.feature +12 -0
- data/vendor/behave/issue.features/issue0188.feature +60 -0
- data/vendor/behave/issue.features/issue0191.feature +178 -0
- data/vendor/behave/issue.features/issue0194.feature +215 -0
- data/vendor/behave/issue.features/issue0197.feature +11 -0
- data/vendor/behave/issue.features/issue0216.feature +129 -0
- data/vendor/behave/issue.features/issue0226.feature +51 -0
- data/vendor/behave/issue.features/issue0228.feature +41 -0
- data/vendor/behave/issue.features/issue0230.feature +46 -0
- data/vendor/behave/issue.features/issue0231.feature +77 -0
- data/vendor/behave/issue.features/issue0238.feature +52 -0
- data/vendor/behave/issue.features/issue0251.feature +15 -0
- data/vendor/behave/issue.features/issue0280.feature +118 -0
- data/vendor/behave/issue.features/issue0288.feature +95 -0
- data/vendor/behave/issue.features/issue0300.feature +49 -0
- data/vendor/behave/issue.features/issue0302.feature +91 -0
- data/vendor/behave/issue.features/issue0309.feature +52 -0
- data/vendor/behave/issue.features/issue0330.feature +124 -0
- data/vendor/behave/issue.features/issue0349.feature +9 -0
- data/vendor/behave/issue.features/issue0361.feature +79 -0
- data/vendor/behave/issue.features/issue0383.feature +76 -0
- data/vendor/behave/issue.features/issue0384.feature +103 -0
- data/vendor/behave/issue.features/issue0385.feature +109 -0
- data/vendor/behave/issue.features/issue0424.feature +66 -0
- data/vendor/behave/issue.features/issue0446.feature +116 -0
- data/vendor/behave/issue.features/issue0449.feature +42 -0
- data/vendor/behave/issue.features/issue0453.feature +42 -0
- data/vendor/behave/issue.features/issue0457.feature +65 -0
- data/vendor/behave/issue.features/issue0462.feature +38 -0
- data/vendor/behave/issue.features/issue0476.feature +39 -0
- data/vendor/behave/issue.features/issue0487.feature +92 -0
- data/vendor/behave/issue.features/issue0506.feature +77 -0
- data/vendor/behave/issue.features/issue0510.feature +51 -0
- data/vendor/behave/issue.features/requirements.txt +12 -0
- data/vendor/behave/issue.features/steps/ansi_steps.py +20 -0
- data/vendor/behave/issue.features/steps/behave_hooks_steps.py +10 -0
- data/vendor/behave/issue.features/steps/use_steplib_behave4cmd.py +13 -0
- data/vendor/behave/more.features/formatter.json.validate_output.feature +37 -0
- data/vendor/behave/more.features/steps/tutorial_steps.py +16 -0
- data/vendor/behave/more.features/steps/use_steplib_behave4cmd.py +7 -0
- data/vendor/behave/more.features/tutorial.feature +6 -0
- data/vendor/behave/py.requirements/README.txt +5 -0
- data/vendor/behave/py.requirements/all.txt +16 -0
- data/vendor/behave/py.requirements/basic.txt +21 -0
- data/vendor/behave/py.requirements/develop.txt +28 -0
- data/vendor/behave/py.requirements/docs.txt +6 -0
- data/vendor/behave/py.requirements/json.txt +7 -0
- data/vendor/behave/py.requirements/more_py26.txt +8 -0
- data/vendor/behave/py.requirements/testing.txt +10 -0
- data/vendor/behave/pytest.ini +24 -0
- data/vendor/behave/setup.cfg +29 -0
- data/vendor/behave/setup.py +118 -0
- data/vendor/behave/setuptools_behave.py +130 -0
- data/vendor/behave/tasks/__behave.py +45 -0
- data/vendor/behave/tasks/__init__.py +55 -0
- data/vendor/behave/tasks/__main__.py +70 -0
- data/vendor/behave/tasks/_setup.py +135 -0
- data/vendor/behave/tasks/_vendor/README.rst +35 -0
- data/vendor/behave/tasks/_vendor/invoke.zip +0 -0
- data/vendor/behave/tasks/_vendor/path.py +1725 -0
- data/vendor/behave/tasks/_vendor/pathlib.py +1280 -0
- data/vendor/behave/tasks/_vendor/six.py +868 -0
- data/vendor/behave/tasks/clean.py +246 -0
- data/vendor/behave/tasks/docs.py +97 -0
- data/vendor/behave/tasks/requirements.txt +17 -0
- data/vendor/behave/tasks/test.py +192 -0
- data/vendor/behave/test/__init__.py +0 -0
- data/vendor/behave/test/_importer_candidate.py +3 -0
- data/vendor/behave/test/reporters/__init__.py +0 -0
- data/vendor/behave/test/reporters/test_summary.py +240 -0
- data/vendor/behave/test/test_ansi_escapes.py +73 -0
- data/vendor/behave/test/test_configuration.py +172 -0
- data/vendor/behave/test/test_formatter.py +265 -0
- data/vendor/behave/test/test_formatter_progress.py +39 -0
- data/vendor/behave/test/test_formatter_rerun.py +97 -0
- data/vendor/behave/test/test_formatter_tags.py +57 -0
- data/vendor/behave/test/test_importer.py +151 -0
- data/vendor/behave/test/test_log_capture.py +29 -0
- data/vendor/behave/test/test_matchers.py +236 -0
- data/vendor/behave/test/test_model.py +871 -0
- data/vendor/behave/test/test_parser.py +1590 -0
- data/vendor/behave/test/test_runner.py +1074 -0
- data/vendor/behave/test/test_step_registry.py +96 -0
- data/vendor/behave/test/test_tag_expression.py +506 -0
- data/vendor/behave/test/test_tag_expression2.py +462 -0
- data/vendor/behave/test/test_tag_matcher.py +729 -0
- data/vendor/behave/test/test_userdata.py +184 -0
- data/vendor/behave/tests/README.txt +12 -0
- data/vendor/behave/tests/__init__.py +0 -0
- data/vendor/behave/tests/api/__ONLY_PY34_or_newer.txt +0 -0
- data/vendor/behave/tests/api/__init__.py +0 -0
- data/vendor/behave/tests/api/_test_async_step34.py +130 -0
- data/vendor/behave/tests/api/_test_async_step35.py +75 -0
- data/vendor/behave/tests/api/test_async_step.py +18 -0
- data/vendor/behave/tests/api/testing_support.py +94 -0
- data/vendor/behave/tests/api/testing_support_async.py +21 -0
- data/vendor/behave/tests/issues/test_issue0336.py +66 -0
- data/vendor/behave/tests/issues/test_issue0449.py +55 -0
- data/vendor/behave/tests/issues/test_issue0453.py +62 -0
- data/vendor/behave/tests/issues/test_issue0458.py +54 -0
- data/vendor/behave/tests/issues/test_issue0495.py +65 -0
- data/vendor/behave/tests/unit/__init__.py +0 -0
- data/vendor/behave/tests/unit/test_behave4cmd_command_shell_proc.py +135 -0
- data/vendor/behave/tests/unit/test_capture.py +280 -0
- data/vendor/behave/tests/unit/test_model_core.py +56 -0
- data/vendor/behave/tests/unit/test_textutil.py +267 -0
- data/vendor/behave/tools/test-features/background.feature +9 -0
- data/vendor/behave/tools/test-features/environment.py +8 -0
- data/vendor/behave/tools/test-features/french.feature +11 -0
- data/vendor/behave/tools/test-features/outline.feature +39 -0
- data/vendor/behave/tools/test-features/parse.feature +10 -0
- data/vendor/behave/tools/test-features/step-data.feature +60 -0
- data/vendor/behave/tools/test-features/steps/steps.py +120 -0
- data/vendor/behave/tools/test-features/tags.feature +18 -0
- data/vendor/behave/tox.ini +159 -0
- metadata +562 -0
|
@@ -0,0 +1,1590 @@
|
|
|
1
|
+
#-*- coding: UTF-8 -*-
|
|
2
|
+
|
|
3
|
+
from __future__ import absolute_import
|
|
4
|
+
from nose.tools import *
|
|
5
|
+
|
|
6
|
+
from behave import i18n, model, parser
|
|
7
|
+
|
|
8
|
+
class Common(object):
|
|
9
|
+
def compare_steps(self, steps, expected):
|
|
10
|
+
have = [(s.step_type, s.keyword, s.name, s.text, s.table) for s in steps]
|
|
11
|
+
eq_(have, expected)
|
|
12
|
+
|
|
13
|
+
class TestParser(Common):
|
|
14
|
+
def test_parses_feature_name(self):
|
|
15
|
+
feature = parser.parse_feature(u"Feature: Stuff\n")
|
|
16
|
+
eq_(feature.name, "Stuff")
|
|
17
|
+
|
|
18
|
+
def test_parses_feature_name_without_newline(self):
|
|
19
|
+
feature = parser.parse_feature(u"Feature: Stuff")
|
|
20
|
+
eq_(feature.name, "Stuff")
|
|
21
|
+
|
|
22
|
+
def test_parses_feature_description(self):
|
|
23
|
+
doc = u"""
|
|
24
|
+
Feature: Stuff
|
|
25
|
+
In order to thing
|
|
26
|
+
As an entity
|
|
27
|
+
I want to do stuff
|
|
28
|
+
""".strip()
|
|
29
|
+
feature = parser.parse_feature(doc)
|
|
30
|
+
eq_(feature.name, "Stuff")
|
|
31
|
+
eq_(feature.description,
|
|
32
|
+
["In order to thing", "As an entity", "I want to do stuff"])
|
|
33
|
+
|
|
34
|
+
def test_parses_feature_with_a_tag(self):
|
|
35
|
+
doc = u"""
|
|
36
|
+
@foo
|
|
37
|
+
Feature: Stuff
|
|
38
|
+
In order to thing
|
|
39
|
+
As an entity
|
|
40
|
+
I want to do stuff
|
|
41
|
+
""".strip()
|
|
42
|
+
feature = parser.parse_feature(doc)
|
|
43
|
+
eq_(feature.name, "Stuff")
|
|
44
|
+
eq_(feature.description,
|
|
45
|
+
["In order to thing", "As an entity", "I want to do stuff"])
|
|
46
|
+
eq_(feature.tags, [model.Tag(u'foo', 1)])
|
|
47
|
+
|
|
48
|
+
def test_parses_feature_with_more_tags(self):
|
|
49
|
+
doc = u"""
|
|
50
|
+
@foo @bar @baz @qux @winkle_pickers @number8
|
|
51
|
+
Feature: Stuff
|
|
52
|
+
In order to thing
|
|
53
|
+
As an entity
|
|
54
|
+
I want to do stuff
|
|
55
|
+
""".strip()
|
|
56
|
+
feature = parser.parse_feature(doc)
|
|
57
|
+
eq_(feature.name, "Stuff")
|
|
58
|
+
eq_(feature.description,
|
|
59
|
+
["In order to thing", "As an entity", "I want to do stuff"])
|
|
60
|
+
eq_(feature.tags, [model.Tag(name, 1)
|
|
61
|
+
for name in (u'foo', u'bar', u'baz', u'qux', u'winkle_pickers', u'number8')])
|
|
62
|
+
|
|
63
|
+
def test_parses_feature_with_a_tag_and_comment(self):
|
|
64
|
+
doc = u"""
|
|
65
|
+
@foo # Comment: ...
|
|
66
|
+
Feature: Stuff
|
|
67
|
+
In order to thing
|
|
68
|
+
As an entity
|
|
69
|
+
I want to do stuff
|
|
70
|
+
""".strip()
|
|
71
|
+
feature = parser.parse_feature(doc)
|
|
72
|
+
eq_(feature.name, "Stuff")
|
|
73
|
+
eq_(feature.description,
|
|
74
|
+
["In order to thing", "As an entity", "I want to do stuff"])
|
|
75
|
+
eq_(feature.tags, [model.Tag(u'foo', 1)])
|
|
76
|
+
|
|
77
|
+
def test_parses_feature_with_more_tags_and_comment(self):
|
|
78
|
+
doc = u"""
|
|
79
|
+
@foo @bar @baz @qux @winkle_pickers # Comment: @number8
|
|
80
|
+
Feature: Stuff
|
|
81
|
+
In order to thing
|
|
82
|
+
As an entity
|
|
83
|
+
I want to do stuff
|
|
84
|
+
""".strip()
|
|
85
|
+
feature = parser.parse_feature(doc)
|
|
86
|
+
eq_(feature.name, "Stuff")
|
|
87
|
+
eq_(feature.description,
|
|
88
|
+
["In order to thing", "As an entity", "I want to do stuff"])
|
|
89
|
+
eq_(feature.tags, [model.Tag(name, 1)
|
|
90
|
+
for name in (u'foo', u'bar', u'baz', u'qux', u'winkle_pickers')])
|
|
91
|
+
# -- NOT A TAG: u'number8'
|
|
92
|
+
|
|
93
|
+
def test_parses_feature_with_background(self):
|
|
94
|
+
doc = u"""
|
|
95
|
+
Feature: Stuff
|
|
96
|
+
Background:
|
|
97
|
+
Given there is stuff
|
|
98
|
+
When I do stuff
|
|
99
|
+
Then stuff happens
|
|
100
|
+
""".lstrip()
|
|
101
|
+
feature = parser.parse_feature(doc)
|
|
102
|
+
eq_(feature.name, "Stuff")
|
|
103
|
+
assert(feature.background)
|
|
104
|
+
self.compare_steps(feature.background.steps, [
|
|
105
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
106
|
+
('when', 'When', 'I do stuff', None, None),
|
|
107
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
108
|
+
])
|
|
109
|
+
|
|
110
|
+
def test_parses_feature_with_description_and_background(self):
|
|
111
|
+
doc = u"""
|
|
112
|
+
Feature: Stuff
|
|
113
|
+
This... is... STUFF!
|
|
114
|
+
|
|
115
|
+
Background:
|
|
116
|
+
Given there is stuff
|
|
117
|
+
When I do stuff
|
|
118
|
+
Then stuff happens
|
|
119
|
+
""".lstrip()
|
|
120
|
+
feature = parser.parse_feature(doc)
|
|
121
|
+
eq_(feature.name, "Stuff")
|
|
122
|
+
eq_(feature.description, ["This... is... STUFF!"])
|
|
123
|
+
assert(feature.background)
|
|
124
|
+
self.compare_steps(feature.background.steps, [
|
|
125
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
126
|
+
('when', 'When', 'I do stuff', None, None),
|
|
127
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
128
|
+
])
|
|
129
|
+
|
|
130
|
+
def test_parses_feature_with_a_scenario(self):
|
|
131
|
+
doc = u"""
|
|
132
|
+
Feature: Stuff
|
|
133
|
+
|
|
134
|
+
Scenario: Doing stuff
|
|
135
|
+
Given there is stuff
|
|
136
|
+
When I do stuff
|
|
137
|
+
Then stuff happens
|
|
138
|
+
""".lstrip()
|
|
139
|
+
feature = parser.parse_feature(doc)
|
|
140
|
+
eq_(feature.name, "Stuff")
|
|
141
|
+
assert(len(feature.scenarios) == 1)
|
|
142
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
143
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
144
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
145
|
+
('when', 'When', 'I do stuff', None, None),
|
|
146
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
147
|
+
])
|
|
148
|
+
|
|
149
|
+
def test_parses_lowercase_step_keywords(self):
|
|
150
|
+
doc = u"""
|
|
151
|
+
Feature: Stuff
|
|
152
|
+
|
|
153
|
+
Scenario: Doing stuff
|
|
154
|
+
giVeN there is stuff
|
|
155
|
+
when I do stuff
|
|
156
|
+
tHEn stuff happens
|
|
157
|
+
""".lstrip()
|
|
158
|
+
feature = parser.parse_feature(doc)
|
|
159
|
+
eq_(feature.name, "Stuff")
|
|
160
|
+
assert(len(feature.scenarios) == 1)
|
|
161
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
162
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
163
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
164
|
+
('when', 'When', 'I do stuff', None, None),
|
|
165
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
166
|
+
])
|
|
167
|
+
|
|
168
|
+
def test_parses_ja_keywords(self):
|
|
169
|
+
doc = u"""
|
|
170
|
+
機能: Stuff
|
|
171
|
+
|
|
172
|
+
シナリオ: Doing stuff
|
|
173
|
+
前提there is stuff
|
|
174
|
+
もしI do stuff
|
|
175
|
+
ならばstuff happens
|
|
176
|
+
""".lstrip()
|
|
177
|
+
feature = parser.parse_feature(doc, language='ja')
|
|
178
|
+
eq_(feature.name, "Stuff")
|
|
179
|
+
assert(len(feature.scenarios) == 1)
|
|
180
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
181
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
182
|
+
('given', u'前提', 'there is stuff', None, None),
|
|
183
|
+
('when', u'もし', 'I do stuff', None, None),
|
|
184
|
+
('then', u'ならば', 'stuff happens', None, None),
|
|
185
|
+
])
|
|
186
|
+
|
|
187
|
+
def test_parses_feature_with_description_and_background_and_scenario(self):
|
|
188
|
+
doc = u"""
|
|
189
|
+
Feature: Stuff
|
|
190
|
+
Oh my god, it's full of stuff...
|
|
191
|
+
|
|
192
|
+
Background:
|
|
193
|
+
Given I found some stuff
|
|
194
|
+
|
|
195
|
+
Scenario: Doing stuff
|
|
196
|
+
Given there is stuff
|
|
197
|
+
When I do stuff
|
|
198
|
+
Then stuff happens
|
|
199
|
+
""".lstrip()
|
|
200
|
+
feature = parser.parse_feature(doc)
|
|
201
|
+
eq_(feature.name, "Stuff")
|
|
202
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
203
|
+
assert(feature.background)
|
|
204
|
+
self.compare_steps(feature.background.steps, [
|
|
205
|
+
('given', 'Given', 'I found some stuff', None, None),
|
|
206
|
+
])
|
|
207
|
+
|
|
208
|
+
assert(len(feature.scenarios) == 1)
|
|
209
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
210
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
211
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
212
|
+
('when', 'When', 'I do stuff', None, None),
|
|
213
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
214
|
+
])
|
|
215
|
+
|
|
216
|
+
def test_parses_feature_with_multiple_scenarios(self):
|
|
217
|
+
doc = u"""
|
|
218
|
+
Feature: Stuff
|
|
219
|
+
|
|
220
|
+
Scenario: Doing stuff
|
|
221
|
+
Given there is stuff
|
|
222
|
+
When I do stuff
|
|
223
|
+
Then stuff happens
|
|
224
|
+
|
|
225
|
+
Scenario: Doing other stuff
|
|
226
|
+
When stuff happens
|
|
227
|
+
Then I am stuffed
|
|
228
|
+
|
|
229
|
+
Scenario: Doing different stuff
|
|
230
|
+
Given stuff
|
|
231
|
+
Then who gives a stuff
|
|
232
|
+
""".lstrip()
|
|
233
|
+
feature = parser.parse_feature(doc)
|
|
234
|
+
eq_(feature.name, "Stuff")
|
|
235
|
+
|
|
236
|
+
assert(len(feature.scenarios) == 3)
|
|
237
|
+
|
|
238
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
239
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
240
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
241
|
+
('when', 'When', 'I do stuff', None, None),
|
|
242
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
243
|
+
])
|
|
244
|
+
|
|
245
|
+
eq_(feature.scenarios[1].name, 'Doing other stuff')
|
|
246
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
247
|
+
('when', 'When', 'stuff happens', None, None),
|
|
248
|
+
('then', 'Then', 'I am stuffed', None, None),
|
|
249
|
+
])
|
|
250
|
+
|
|
251
|
+
eq_(feature.scenarios[2].name, 'Doing different stuff')
|
|
252
|
+
self.compare_steps(feature.scenarios[2].steps, [
|
|
253
|
+
('given', 'Given', 'stuff', None, None),
|
|
254
|
+
('then', 'Then', 'who gives a stuff', None, None),
|
|
255
|
+
])
|
|
256
|
+
|
|
257
|
+
def test_parses_feature_with_multiple_scenarios_with_tags(self):
|
|
258
|
+
doc = u"""
|
|
259
|
+
Feature: Stuff
|
|
260
|
+
|
|
261
|
+
Scenario: Doing stuff
|
|
262
|
+
Given there is stuff
|
|
263
|
+
When I do stuff
|
|
264
|
+
Then stuff happens
|
|
265
|
+
|
|
266
|
+
@one_tag
|
|
267
|
+
Scenario: Doing other stuff
|
|
268
|
+
When stuff happens
|
|
269
|
+
Then I am stuffed
|
|
270
|
+
|
|
271
|
+
@lots @of @tags
|
|
272
|
+
Scenario: Doing different stuff
|
|
273
|
+
Given stuff
|
|
274
|
+
Then who gives a stuff
|
|
275
|
+
""".lstrip()
|
|
276
|
+
feature = parser.parse_feature(doc)
|
|
277
|
+
eq_(feature.name, "Stuff")
|
|
278
|
+
|
|
279
|
+
assert(len(feature.scenarios) == 3)
|
|
280
|
+
|
|
281
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
282
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
283
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
284
|
+
('when', 'When', 'I do stuff', None, None),
|
|
285
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
286
|
+
])
|
|
287
|
+
|
|
288
|
+
eq_(feature.scenarios[1].name, 'Doing other stuff')
|
|
289
|
+
eq_(feature.scenarios[1].tags, [model.Tag(u'one_tag', 1)])
|
|
290
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
291
|
+
('when', 'When', 'stuff happens', None, None),
|
|
292
|
+
('then', 'Then', 'I am stuffed', None, None),
|
|
293
|
+
])
|
|
294
|
+
|
|
295
|
+
eq_(feature.scenarios[2].name, 'Doing different stuff')
|
|
296
|
+
eq_(feature.scenarios[2].tags, [model.Tag(n, 1) for n in (u'lots', u'of', u'tags')])
|
|
297
|
+
self.compare_steps(feature.scenarios[2].steps, [
|
|
298
|
+
('given', 'Given', 'stuff', None, None),
|
|
299
|
+
('then', 'Then', 'who gives a stuff', None, None),
|
|
300
|
+
])
|
|
301
|
+
|
|
302
|
+
def test_parses_feature_with_multiple_scenarios_and_other_bits(self):
|
|
303
|
+
doc = u"""
|
|
304
|
+
Feature: Stuff
|
|
305
|
+
Stuffing
|
|
306
|
+
|
|
307
|
+
Background:
|
|
308
|
+
Given you're all stuffed
|
|
309
|
+
|
|
310
|
+
Scenario: Doing stuff
|
|
311
|
+
Given there is stuff
|
|
312
|
+
When I do stuff
|
|
313
|
+
Then stuff happens
|
|
314
|
+
|
|
315
|
+
Scenario: Doing other stuff
|
|
316
|
+
When stuff happens
|
|
317
|
+
Then I am stuffed
|
|
318
|
+
|
|
319
|
+
Scenario: Doing different stuff
|
|
320
|
+
Given stuff
|
|
321
|
+
Then who gives a stuff
|
|
322
|
+
""".lstrip()
|
|
323
|
+
feature = parser.parse_feature(doc)
|
|
324
|
+
eq_(feature.name, "Stuff")
|
|
325
|
+
eq_(feature.description, ["Stuffing"])
|
|
326
|
+
|
|
327
|
+
assert(feature.background)
|
|
328
|
+
self.compare_steps(feature.background.steps, [
|
|
329
|
+
('given', 'Given', "you're all stuffed", None, None)
|
|
330
|
+
])
|
|
331
|
+
|
|
332
|
+
assert(len(feature.scenarios) == 3)
|
|
333
|
+
|
|
334
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
335
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
336
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
337
|
+
('when', 'When', 'I do stuff', None, None),
|
|
338
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
339
|
+
])
|
|
340
|
+
|
|
341
|
+
eq_(feature.scenarios[1].name, 'Doing other stuff')
|
|
342
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
343
|
+
('when', 'When', 'stuff happens', None, None),
|
|
344
|
+
('then', 'Then', 'I am stuffed', None, None),
|
|
345
|
+
])
|
|
346
|
+
|
|
347
|
+
eq_(feature.scenarios[2].name, 'Doing different stuff')
|
|
348
|
+
self.compare_steps(feature.scenarios[2].steps, [
|
|
349
|
+
('given', 'Given', 'stuff', None, None),
|
|
350
|
+
('then', 'Then', 'who gives a stuff', None, None),
|
|
351
|
+
])
|
|
352
|
+
|
|
353
|
+
def test_parses_feature_with_a_scenario_with_and_and_but(self):
|
|
354
|
+
doc = u"""
|
|
355
|
+
Feature: Stuff
|
|
356
|
+
|
|
357
|
+
Scenario: Doing stuff
|
|
358
|
+
Given there is stuff
|
|
359
|
+
And some other stuff
|
|
360
|
+
When I do stuff
|
|
361
|
+
Then stuff happens
|
|
362
|
+
But not the bad stuff
|
|
363
|
+
""".lstrip()
|
|
364
|
+
feature = parser.parse_feature(doc)
|
|
365
|
+
eq_(feature.name, "Stuff")
|
|
366
|
+
assert(len(feature.scenarios) == 1)
|
|
367
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
368
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
369
|
+
('given', 'Given', 'there is stuff', None, None),
|
|
370
|
+
('given', 'And', 'some other stuff', None, None),
|
|
371
|
+
('when', 'When', 'I do stuff', None, None),
|
|
372
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
373
|
+
('then', 'But', 'not the bad stuff', None, None),
|
|
374
|
+
])
|
|
375
|
+
|
|
376
|
+
def test_parses_feature_with_a_step_with_a_string_argument(self):
|
|
377
|
+
doc = u'''
|
|
378
|
+
Feature: Stuff
|
|
379
|
+
|
|
380
|
+
Scenario: Doing stuff
|
|
381
|
+
Given there is stuff:
|
|
382
|
+
"""
|
|
383
|
+
So
|
|
384
|
+
Much
|
|
385
|
+
Stuff
|
|
386
|
+
"""
|
|
387
|
+
Then stuff happens
|
|
388
|
+
'''.lstrip()
|
|
389
|
+
feature = parser.parse_feature(doc)
|
|
390
|
+
eq_(feature.name, "Stuff")
|
|
391
|
+
assert(len(feature.scenarios) == 1)
|
|
392
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
393
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
394
|
+
('given', 'Given', 'there is stuff', "So\nMuch\nStuff", None),
|
|
395
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
396
|
+
])
|
|
397
|
+
|
|
398
|
+
def test_parses_string_argument_correctly_handle_whitespace(self):
|
|
399
|
+
doc = u'''
|
|
400
|
+
Feature: Stuff
|
|
401
|
+
|
|
402
|
+
Scenario: Doing stuff
|
|
403
|
+
Given there is stuff:
|
|
404
|
+
"""
|
|
405
|
+
So
|
|
406
|
+
Much
|
|
407
|
+
Stuff
|
|
408
|
+
Has
|
|
409
|
+
Indents
|
|
410
|
+
"""
|
|
411
|
+
Then stuff happens
|
|
412
|
+
'''.lstrip()
|
|
413
|
+
feature = parser.parse_feature(doc)
|
|
414
|
+
eq_(feature.name, "Stuff")
|
|
415
|
+
assert(len(feature.scenarios) == 1)
|
|
416
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
417
|
+
string = "So\n Much\n Stuff\n Has\nIndents"
|
|
418
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
419
|
+
('given', 'Given', 'there is stuff', string, None),
|
|
420
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
421
|
+
])
|
|
422
|
+
|
|
423
|
+
def test_parses_feature_with_a_step_with_a_string_with_blank_lines(self):
|
|
424
|
+
doc = u'''
|
|
425
|
+
Feature: Stuff
|
|
426
|
+
|
|
427
|
+
Scenario: Doing stuff
|
|
428
|
+
Given there is stuff:
|
|
429
|
+
"""
|
|
430
|
+
So
|
|
431
|
+
|
|
432
|
+
Much
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
Stuff
|
|
436
|
+
"""
|
|
437
|
+
Then stuff happens
|
|
438
|
+
'''.lstrip()
|
|
439
|
+
feature = parser.parse_feature(doc)
|
|
440
|
+
eq_(feature.name, "Stuff")
|
|
441
|
+
assert(len(feature.scenarios) == 1)
|
|
442
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
443
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
444
|
+
('given', 'Given', 'there is stuff', "So\n\nMuch\n\n\nStuff", None),
|
|
445
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
446
|
+
])
|
|
447
|
+
|
|
448
|
+
# MORE-JE-ADDED:
|
|
449
|
+
def test_parses_string_argument_without_stripping_empty_lines(self):
|
|
450
|
+
# -- ISSUE 44: Parser removes comments in multiline text string.
|
|
451
|
+
doc = u'''
|
|
452
|
+
Feature: Multiline
|
|
453
|
+
|
|
454
|
+
Scenario: Multiline Text with Comments
|
|
455
|
+
Given a multiline argument with:
|
|
456
|
+
"""
|
|
457
|
+
|
|
458
|
+
"""
|
|
459
|
+
And a multiline argument with:
|
|
460
|
+
"""
|
|
461
|
+
Alpha.
|
|
462
|
+
|
|
463
|
+
Omega.
|
|
464
|
+
"""
|
|
465
|
+
Then empty middle lines are not stripped
|
|
466
|
+
'''.lstrip()
|
|
467
|
+
feature = parser.parse_feature(doc)
|
|
468
|
+
eq_(feature.name, "Multiline")
|
|
469
|
+
assert(len(feature.scenarios) == 1)
|
|
470
|
+
eq_(feature.scenarios[0].name, "Multiline Text with Comments")
|
|
471
|
+
text1 = ""
|
|
472
|
+
text2 = "Alpha.\n\nOmega."
|
|
473
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
474
|
+
('given', 'Given', 'a multiline argument with', text1, None),
|
|
475
|
+
('given', 'And', 'a multiline argument with', text2, None),
|
|
476
|
+
('then', 'Then', 'empty middle lines are not stripped', None, None),
|
|
477
|
+
])
|
|
478
|
+
|
|
479
|
+
def test_parses_feature_with_a_step_with_a_string_with_comments(self):
|
|
480
|
+
doc = u'''
|
|
481
|
+
Feature: Stuff
|
|
482
|
+
|
|
483
|
+
Scenario: Doing stuff
|
|
484
|
+
Given there is stuff:
|
|
485
|
+
"""
|
|
486
|
+
So
|
|
487
|
+
Much
|
|
488
|
+
# Derp
|
|
489
|
+
"""
|
|
490
|
+
Then stuff happens
|
|
491
|
+
'''.lstrip()
|
|
492
|
+
feature = parser.parse_feature(doc)
|
|
493
|
+
eq_(feature.name, "Stuff")
|
|
494
|
+
assert(len(feature.scenarios) == 1)
|
|
495
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
496
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
497
|
+
('given', 'Given', 'there is stuff', "So\nMuch\n# Derp",
|
|
498
|
+
None),
|
|
499
|
+
('then', 'Then', 'stuff happens', None, None),
|
|
500
|
+
])
|
|
501
|
+
|
|
502
|
+
def test_parses_feature_with_a_step_with_a_table_argument(self):
|
|
503
|
+
doc = u'''
|
|
504
|
+
Feature: Stuff
|
|
505
|
+
|
|
506
|
+
Scenario: Doing stuff
|
|
507
|
+
Given we classify stuff:
|
|
508
|
+
| type of stuff | awesomeness | ridiculousness |
|
|
509
|
+
| fluffy | large | frequent |
|
|
510
|
+
| lint | low | high |
|
|
511
|
+
| green | variable | awkward |
|
|
512
|
+
Then stuff is in buckets
|
|
513
|
+
'''.lstrip()
|
|
514
|
+
feature = parser.parse_feature(doc)
|
|
515
|
+
eq_(feature.name, "Stuff")
|
|
516
|
+
assert(len(feature.scenarios) == 1)
|
|
517
|
+
eq_(feature.scenarios[0].name, 'Doing stuff')
|
|
518
|
+
table = model.Table(
|
|
519
|
+
[u'type of stuff', u'awesomeness', u'ridiculousness'],
|
|
520
|
+
0,
|
|
521
|
+
[
|
|
522
|
+
[u'fluffy', u'large', u'frequent'],
|
|
523
|
+
[u'lint', u'low', u'high'],
|
|
524
|
+
[u'green', u'variable', u'awkward'],
|
|
525
|
+
]
|
|
526
|
+
)
|
|
527
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
528
|
+
('given', 'Given', 'we classify stuff', None, table),
|
|
529
|
+
('then', 'Then', 'stuff is in buckets', None, None),
|
|
530
|
+
])
|
|
531
|
+
|
|
532
|
+
def test_parses_feature_with_table_and_escaped_pipe_in_cell_values(self):
|
|
533
|
+
doc = u'''
|
|
534
|
+
Feature:
|
|
535
|
+
Scenario:
|
|
536
|
+
Given we have special cell values:
|
|
537
|
+
| name | value |
|
|
538
|
+
| alice | one\|two |
|
|
539
|
+
| bob |\|one |
|
|
540
|
+
| charly | one\||
|
|
541
|
+
| doro | one\|two\|three\|four |
|
|
542
|
+
'''.lstrip()
|
|
543
|
+
feature = parser.parse_feature(doc)
|
|
544
|
+
assert(len(feature.scenarios) == 1)
|
|
545
|
+
table = model.Table(
|
|
546
|
+
[u"name", u"value"],
|
|
547
|
+
0,
|
|
548
|
+
[
|
|
549
|
+
[u"alice", u"one|two"],
|
|
550
|
+
[u"bob", u"|one"],
|
|
551
|
+
[u"charly", u"one|"],
|
|
552
|
+
[u"doro", u"one|two|three|four"],
|
|
553
|
+
]
|
|
554
|
+
)
|
|
555
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
556
|
+
('given', 'Given', 'we have special cell values', None, table),
|
|
557
|
+
])
|
|
558
|
+
|
|
559
|
+
def test_parses_feature_with_a_scenario_outline(self):
|
|
560
|
+
doc = u'''
|
|
561
|
+
Feature: Stuff
|
|
562
|
+
|
|
563
|
+
Scenario Outline: Doing all sorts of stuff
|
|
564
|
+
Given we have <Stuff>
|
|
565
|
+
When we do stuff
|
|
566
|
+
Then we have <Things>
|
|
567
|
+
|
|
568
|
+
Examples: Some stuff
|
|
569
|
+
| Stuff | Things |
|
|
570
|
+
| wool | felt |
|
|
571
|
+
| cotton | thread |
|
|
572
|
+
| wood | paper |
|
|
573
|
+
| explosives | hilarity |
|
|
574
|
+
'''.lstrip()
|
|
575
|
+
feature = parser.parse_feature(doc)
|
|
576
|
+
eq_(feature.name, "Stuff")
|
|
577
|
+
|
|
578
|
+
assert(len(feature.scenarios) == 1)
|
|
579
|
+
eq_(feature.scenarios[0].name, 'Doing all sorts of stuff')
|
|
580
|
+
|
|
581
|
+
table = model.Table(
|
|
582
|
+
[u'Stuff', u'Things'],
|
|
583
|
+
0,
|
|
584
|
+
[
|
|
585
|
+
[u'wool', u'felt'],
|
|
586
|
+
[u'cotton', u'thread'],
|
|
587
|
+
[u'wood', u'paper'],
|
|
588
|
+
[u'explosives', u'hilarity'],
|
|
589
|
+
]
|
|
590
|
+
)
|
|
591
|
+
eq_(feature.scenarios[0].examples[0].name, 'Some stuff')
|
|
592
|
+
eq_(feature.scenarios[0].examples[0].table, table)
|
|
593
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
594
|
+
('given', 'Given', 'we have <Stuff>', None, None),
|
|
595
|
+
('when', 'When', 'we do stuff', None, None),
|
|
596
|
+
('then', 'Then', 'we have <Things>', None, None),
|
|
597
|
+
])
|
|
598
|
+
|
|
599
|
+
def test_parses_feature_with_a_scenario_outline_with_multiple_examples(self):
|
|
600
|
+
doc = u'''
|
|
601
|
+
Feature: Stuff
|
|
602
|
+
|
|
603
|
+
Scenario Outline: Doing all sorts of stuff
|
|
604
|
+
Given we have <Stuff>
|
|
605
|
+
When we do stuff
|
|
606
|
+
Then we have <Things>
|
|
607
|
+
|
|
608
|
+
Examples: Some stuff
|
|
609
|
+
| Stuff | Things |
|
|
610
|
+
| wool | felt |
|
|
611
|
+
| cotton | thread |
|
|
612
|
+
|
|
613
|
+
Examples: Some other stuff
|
|
614
|
+
| Stuff | Things |
|
|
615
|
+
| wood | paper |
|
|
616
|
+
| explosives | hilarity |
|
|
617
|
+
'''.lstrip()
|
|
618
|
+
feature = parser.parse_feature(doc)
|
|
619
|
+
eq_(feature.name, "Stuff")
|
|
620
|
+
|
|
621
|
+
assert(len(feature.scenarios) == 1)
|
|
622
|
+
eq_(feature.scenarios[0].name, 'Doing all sorts of stuff')
|
|
623
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
624
|
+
('given', 'Given', 'we have <Stuff>', None, None),
|
|
625
|
+
('when', 'When', 'we do stuff', None, None),
|
|
626
|
+
('then', 'Then', 'we have <Things>', None, None),
|
|
627
|
+
])
|
|
628
|
+
|
|
629
|
+
table = model.Table(
|
|
630
|
+
[u'Stuff', u'Things'],
|
|
631
|
+
0,
|
|
632
|
+
[
|
|
633
|
+
[u'wool', u'felt'],
|
|
634
|
+
[u'cotton', u'thread'],
|
|
635
|
+
]
|
|
636
|
+
)
|
|
637
|
+
eq_(feature.scenarios[0].examples[0].name, 'Some stuff')
|
|
638
|
+
eq_(feature.scenarios[0].examples[0].table, table)
|
|
639
|
+
|
|
640
|
+
table = model.Table(
|
|
641
|
+
[u'Stuff', u'Things'],
|
|
642
|
+
0,
|
|
643
|
+
[
|
|
644
|
+
[u'wood', u'paper'],
|
|
645
|
+
[u'explosives', u'hilarity'],
|
|
646
|
+
]
|
|
647
|
+
)
|
|
648
|
+
eq_(feature.scenarios[0].examples[1].name, 'Some other stuff')
|
|
649
|
+
eq_(feature.scenarios[0].examples[1].table, table)
|
|
650
|
+
|
|
651
|
+
def test_parses_feature_with_a_scenario_outline_with_tags(self):
|
|
652
|
+
doc = u'''
|
|
653
|
+
Feature: Stuff
|
|
654
|
+
|
|
655
|
+
@stuff @derp
|
|
656
|
+
Scenario Outline: Doing all sorts of stuff
|
|
657
|
+
Given we have <Stuff>
|
|
658
|
+
When we do stuff
|
|
659
|
+
Then we have <Things>
|
|
660
|
+
|
|
661
|
+
Examples: Some stuff
|
|
662
|
+
| Stuff | Things |
|
|
663
|
+
| wool | felt |
|
|
664
|
+
| cotton | thread |
|
|
665
|
+
| wood | paper |
|
|
666
|
+
| explosives | hilarity |
|
|
667
|
+
'''.lstrip()
|
|
668
|
+
feature = parser.parse_feature(doc)
|
|
669
|
+
eq_(feature.name, "Stuff")
|
|
670
|
+
|
|
671
|
+
assert(len(feature.scenarios) == 1)
|
|
672
|
+
eq_(feature.scenarios[0].name, 'Doing all sorts of stuff')
|
|
673
|
+
eq_(feature.scenarios[0].tags, [model.Tag(u'stuff', 1), model.Tag(u'derp', 1)])
|
|
674
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
675
|
+
('given', 'Given', 'we have <Stuff>', None, None),
|
|
676
|
+
('when', 'When', 'we do stuff', None, None),
|
|
677
|
+
('then', 'Then', 'we have <Things>', None, None),
|
|
678
|
+
])
|
|
679
|
+
|
|
680
|
+
table = model.Table(
|
|
681
|
+
[u'Stuff', u'Things'],
|
|
682
|
+
0,
|
|
683
|
+
[
|
|
684
|
+
[u'wool', u'felt'],
|
|
685
|
+
[u'cotton', u'thread'],
|
|
686
|
+
[u'wood', u'paper'],
|
|
687
|
+
[u'explosives', u'hilarity'],
|
|
688
|
+
]
|
|
689
|
+
)
|
|
690
|
+
eq_(feature.scenarios[0].examples[0].name, 'Some stuff')
|
|
691
|
+
eq_(feature.scenarios[0].examples[0].table, table)
|
|
692
|
+
|
|
693
|
+
def test_parses_scenario_outline_with_tagged_examples1(self):
|
|
694
|
+
# -- CASE: Examples with 1 tag-line (= 1 tag)
|
|
695
|
+
doc = u'''
|
|
696
|
+
Feature: Alice
|
|
697
|
+
|
|
698
|
+
@foo
|
|
699
|
+
Scenario Outline: Bob
|
|
700
|
+
Given we have <Stuff>
|
|
701
|
+
|
|
702
|
+
@bar
|
|
703
|
+
Examples: Charly
|
|
704
|
+
| Stuff | Things |
|
|
705
|
+
| wool | felt |
|
|
706
|
+
| cotton | thread |
|
|
707
|
+
'''.lstrip()
|
|
708
|
+
feature = parser.parse_feature(doc)
|
|
709
|
+
eq_(feature.name, "Alice")
|
|
710
|
+
|
|
711
|
+
assert(len(feature.scenarios) == 1)
|
|
712
|
+
scenario_outline = feature.scenarios[0]
|
|
713
|
+
eq_(scenario_outline.name, "Bob")
|
|
714
|
+
eq_(scenario_outline.tags, [model.Tag(u"foo", 1)])
|
|
715
|
+
self.compare_steps(scenario_outline.steps, [
|
|
716
|
+
("given", "Given", "we have <Stuff>", None, None),
|
|
717
|
+
])
|
|
718
|
+
|
|
719
|
+
table = model.Table(
|
|
720
|
+
[u"Stuff", u"Things"], 0,
|
|
721
|
+
[
|
|
722
|
+
[u"wool", u"felt"],
|
|
723
|
+
[u"cotton", u"thread"],
|
|
724
|
+
]
|
|
725
|
+
)
|
|
726
|
+
eq_(scenario_outline.examples[0].name, "Charly")
|
|
727
|
+
eq_(scenario_outline.examples[0].table, table)
|
|
728
|
+
eq_(scenario_outline.examples[0].tags, [model.Tag(u"bar", 1)])
|
|
729
|
+
|
|
730
|
+
# -- ScenarioOutline.scenarios:
|
|
731
|
+
# Inherit tags from ScenarioOutline and Examples element.
|
|
732
|
+
eq_(len(scenario_outline.scenarios), 2)
|
|
733
|
+
expected_tags = [model.Tag(u"foo", 1), model.Tag(u"bar", 1)]
|
|
734
|
+
eq_(set(scenario_outline.scenarios[0].tags), set(expected_tags))
|
|
735
|
+
eq_(set(scenario_outline.scenarios[1].tags), set(expected_tags))
|
|
736
|
+
|
|
737
|
+
def test_parses_scenario_outline_with_tagged_examples2(self):
|
|
738
|
+
# -- CASE: Examples with multiple tag-lines (= 2 tag-lines)
|
|
739
|
+
doc = u'''
|
|
740
|
+
Feature: Alice
|
|
741
|
+
|
|
742
|
+
@foo
|
|
743
|
+
Scenario Outline: Bob
|
|
744
|
+
Given we have <Stuff>
|
|
745
|
+
|
|
746
|
+
@bar
|
|
747
|
+
@baz
|
|
748
|
+
Examples: Charly
|
|
749
|
+
| Stuff | Things |
|
|
750
|
+
| wool | felt |
|
|
751
|
+
| cotton | thread |
|
|
752
|
+
'''.lstrip()
|
|
753
|
+
feature = parser.parse_feature(doc)
|
|
754
|
+
eq_(feature.name, "Alice")
|
|
755
|
+
|
|
756
|
+
assert(len(feature.scenarios) == 1)
|
|
757
|
+
scenario_outline = feature.scenarios[0]
|
|
758
|
+
eq_(scenario_outline.name, "Bob")
|
|
759
|
+
eq_(scenario_outline.tags, [model.Tag(u"foo", 1)])
|
|
760
|
+
self.compare_steps(scenario_outline.steps, [
|
|
761
|
+
("given", "Given", "we have <Stuff>", None, None),
|
|
762
|
+
])
|
|
763
|
+
|
|
764
|
+
table = model.Table(
|
|
765
|
+
[u"Stuff", u"Things"], 0,
|
|
766
|
+
[
|
|
767
|
+
[u"wool", u"felt"],
|
|
768
|
+
[u"cotton", u"thread"],
|
|
769
|
+
]
|
|
770
|
+
)
|
|
771
|
+
eq_(scenario_outline.examples[0].name, "Charly")
|
|
772
|
+
eq_(scenario_outline.examples[0].table, table)
|
|
773
|
+
expected_tags = [model.Tag(u"bar", 1), model.Tag(u"baz", 1)]
|
|
774
|
+
eq_(scenario_outline.examples[0].tags, expected_tags)
|
|
775
|
+
|
|
776
|
+
# -- ScenarioOutline.scenarios:
|
|
777
|
+
# Inherit tags from ScenarioOutline and Examples element.
|
|
778
|
+
eq_(len(scenario_outline.scenarios), 2)
|
|
779
|
+
expected_tags = [
|
|
780
|
+
model.Tag(u"foo", 1),
|
|
781
|
+
model.Tag(u"bar", 1),
|
|
782
|
+
model.Tag(u"baz", 1)
|
|
783
|
+
]
|
|
784
|
+
eq_(set(scenario_outline.scenarios[0].tags), set(expected_tags))
|
|
785
|
+
eq_(set(scenario_outline.scenarios[1].tags), set(expected_tags))
|
|
786
|
+
|
|
787
|
+
def test_parses_feature_with_the_lot(self):
|
|
788
|
+
doc = u'''
|
|
789
|
+
# This one's got comments too.
|
|
790
|
+
|
|
791
|
+
@derp
|
|
792
|
+
Feature: Stuff
|
|
793
|
+
In order to test my parser
|
|
794
|
+
As a test runner
|
|
795
|
+
I want to run tests
|
|
796
|
+
|
|
797
|
+
# A møøse once bit my sister
|
|
798
|
+
Background:
|
|
799
|
+
Given this is a test
|
|
800
|
+
|
|
801
|
+
@fred
|
|
802
|
+
Scenario: Testing stuff
|
|
803
|
+
Given we are testing
|
|
804
|
+
And this is only a test
|
|
805
|
+
But this is an important test
|
|
806
|
+
When we test with a multiline string:
|
|
807
|
+
"""
|
|
808
|
+
Yarr, my hovercraft be full of stuff.
|
|
809
|
+
Also, I be feelin' this pirate schtick be a mite overdone, me hearties.
|
|
810
|
+
Also: rum.
|
|
811
|
+
"""
|
|
812
|
+
Then we want it to work
|
|
813
|
+
|
|
814
|
+
#These comments are everywhere man
|
|
815
|
+
Scenario Outline: Gosh this is long
|
|
816
|
+
Given this is <length>
|
|
817
|
+
Then we want it to be <width>
|
|
818
|
+
But not <height>
|
|
819
|
+
|
|
820
|
+
Examples: Initial
|
|
821
|
+
| length | width | height |
|
|
822
|
+
# I don't know why this one is here
|
|
823
|
+
| 1 | 2 | 3 |
|
|
824
|
+
| 4 | 5 | 6 |
|
|
825
|
+
|
|
826
|
+
Examples: Subsequent
|
|
827
|
+
| length | width | height |
|
|
828
|
+
| 7 | 8 | 9 |
|
|
829
|
+
|
|
830
|
+
Scenario: This one doesn't have a tag
|
|
831
|
+
Given we don't have a tag
|
|
832
|
+
Then we don't really mind
|
|
833
|
+
|
|
834
|
+
@stuff @derp
|
|
835
|
+
Scenario Outline: Doing all sorts of stuff
|
|
836
|
+
Given we have <Stuff>
|
|
837
|
+
When we do stuff with a table:
|
|
838
|
+
| a | b | c | d | e |
|
|
839
|
+
| 1 | 2 | 3 | 4 | 5 |
|
|
840
|
+
# I can see a comment line from here
|
|
841
|
+
| 6 | 7 | 8 | 9 | 10 |
|
|
842
|
+
Then we have <Things>
|
|
843
|
+
|
|
844
|
+
Examples: Some stuff
|
|
845
|
+
| Stuff | Things |
|
|
846
|
+
| wool | felt |
|
|
847
|
+
| cotton | thread |
|
|
848
|
+
| wood | paper |
|
|
849
|
+
| explosives | hilarity |
|
|
850
|
+
'''.lstrip()
|
|
851
|
+
feature = parser.parse_feature(doc)
|
|
852
|
+
eq_(feature.name, "Stuff")
|
|
853
|
+
eq_(feature.tags, [model.Tag(u'derp', 1)])
|
|
854
|
+
eq_(feature.description, ['In order to test my parser',
|
|
855
|
+
'As a test runner',
|
|
856
|
+
'I want to run tests'])
|
|
857
|
+
|
|
858
|
+
assert(feature.background)
|
|
859
|
+
self.compare_steps(feature.background.steps, [
|
|
860
|
+
('given', 'Given', 'this is a test', None, None)
|
|
861
|
+
])
|
|
862
|
+
|
|
863
|
+
assert(len(feature.scenarios) == 4)
|
|
864
|
+
|
|
865
|
+
eq_(feature.scenarios[0].name, 'Testing stuff')
|
|
866
|
+
eq_(feature.scenarios[0].tags, [model.Tag(u'fred', 1)])
|
|
867
|
+
string = '\n'.join([
|
|
868
|
+
'Yarr, my hovercraft be full of stuff.',
|
|
869
|
+
"Also, I be feelin' this pirate schtick be a mite overdone, " + \
|
|
870
|
+
"me hearties.",
|
|
871
|
+
' Also: rum.'
|
|
872
|
+
])
|
|
873
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
874
|
+
('given', 'Given', 'we are testing', None, None),
|
|
875
|
+
('given', 'And', 'this is only a test', None, None),
|
|
876
|
+
('given', 'But', 'this is an important test', None, None),
|
|
877
|
+
('when', 'When', 'we test with a multiline string', string, None),
|
|
878
|
+
('then', 'Then', 'we want it to work', None, None),
|
|
879
|
+
])
|
|
880
|
+
|
|
881
|
+
eq_(feature.scenarios[1].name, 'Gosh this is long')
|
|
882
|
+
eq_(feature.scenarios[1].tags, [])
|
|
883
|
+
table = model.Table(
|
|
884
|
+
[u'length', u'width', u'height'],
|
|
885
|
+
0,
|
|
886
|
+
[
|
|
887
|
+
[u'1', u'2', u'3'],
|
|
888
|
+
[u'4', u'5', u'6'],
|
|
889
|
+
]
|
|
890
|
+
)
|
|
891
|
+
eq_(feature.scenarios[1].examples[0].name, 'Initial')
|
|
892
|
+
eq_(feature.scenarios[1].examples[0].table, table)
|
|
893
|
+
table = model.Table(
|
|
894
|
+
[u'length', u'width', u'height'],
|
|
895
|
+
0,
|
|
896
|
+
[
|
|
897
|
+
[u'7', u'8', u'9'],
|
|
898
|
+
]
|
|
899
|
+
)
|
|
900
|
+
eq_(feature.scenarios[1].examples[1].name, 'Subsequent')
|
|
901
|
+
eq_(feature.scenarios[1].examples[1].table, table)
|
|
902
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
903
|
+
('given', 'Given', 'this is <length>', None, None),
|
|
904
|
+
('then', 'Then', 'we want it to be <width>', None, None),
|
|
905
|
+
('then', 'But', 'not <height>', None, None),
|
|
906
|
+
])
|
|
907
|
+
|
|
908
|
+
eq_(feature.scenarios[2].name, "This one doesn't have a tag")
|
|
909
|
+
eq_(feature.scenarios[2].tags, [])
|
|
910
|
+
self.compare_steps(feature.scenarios[2].steps, [
|
|
911
|
+
('given', 'Given', "we don't have a tag", None, None),
|
|
912
|
+
('then', 'Then', "we don't really mind", None, None),
|
|
913
|
+
])
|
|
914
|
+
|
|
915
|
+
table = model.Table(
|
|
916
|
+
[u'Stuff', u'Things'],
|
|
917
|
+
0,
|
|
918
|
+
[
|
|
919
|
+
[u'wool', u'felt'],
|
|
920
|
+
[u'cotton', u'thread'],
|
|
921
|
+
[u'wood', u'paper'],
|
|
922
|
+
[u'explosives', u'hilarity'],
|
|
923
|
+
]
|
|
924
|
+
)
|
|
925
|
+
eq_(feature.scenarios[3].name, 'Doing all sorts of stuff')
|
|
926
|
+
eq_(feature.scenarios[3].tags, [model.Tag(u'stuff', 1), model.Tag(u'derp', 1)])
|
|
927
|
+
eq_(feature.scenarios[3].examples[0].name, 'Some stuff')
|
|
928
|
+
eq_(feature.scenarios[3].examples[0].table, table)
|
|
929
|
+
table = model.Table(
|
|
930
|
+
[u'a', u'b', u'c', u'd', u'e'],
|
|
931
|
+
0,
|
|
932
|
+
[
|
|
933
|
+
[u'1', u'2', u'3', u'4', u'5'],
|
|
934
|
+
[u'6', u'7', u'8', u'9', u'10'],
|
|
935
|
+
]
|
|
936
|
+
)
|
|
937
|
+
self.compare_steps(feature.scenarios[3].steps, [
|
|
938
|
+
('given', 'Given', 'we have <Stuff>', None, None),
|
|
939
|
+
('when', 'When', 'we do stuff with a table', None, table),
|
|
940
|
+
('then', 'Then', 'we have <Things>', None, None),
|
|
941
|
+
])
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
def test_fails_to_parse_when_and_is_out_of_order(self):
|
|
945
|
+
doc = u"""
|
|
946
|
+
Feature: Stuff
|
|
947
|
+
|
|
948
|
+
Scenario: Failing at stuff
|
|
949
|
+
And we should fail
|
|
950
|
+
""".lstrip()
|
|
951
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
952
|
+
|
|
953
|
+
def test_fails_to_parse_when_but_is_out_of_order(self):
|
|
954
|
+
doc = u"""
|
|
955
|
+
Feature: Stuff
|
|
956
|
+
|
|
957
|
+
Scenario: Failing at stuff
|
|
958
|
+
But we shall fail
|
|
959
|
+
""".lstrip()
|
|
960
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
961
|
+
|
|
962
|
+
def test_fails_to_parse_when_examples_is_in_the_wrong_place(self):
|
|
963
|
+
doc = u"""
|
|
964
|
+
Feature: Stuff
|
|
965
|
+
|
|
966
|
+
Scenario: Failing at stuff
|
|
967
|
+
But we shall fail
|
|
968
|
+
|
|
969
|
+
Examples: Failure
|
|
970
|
+
| Fail | Wheel|
|
|
971
|
+
""".lstrip()
|
|
972
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
973
|
+
|
|
974
|
+
class TestForeign(Common):
|
|
975
|
+
def test_first_line_comment_sets_language(self):
|
|
976
|
+
doc = u"""
|
|
977
|
+
# language: fr
|
|
978
|
+
Fonctionnalit\xe9: testing stuff
|
|
979
|
+
Oh my god, it's full of stuff...
|
|
980
|
+
"""
|
|
981
|
+
|
|
982
|
+
feature = parser.parse_feature(doc)
|
|
983
|
+
eq_(feature.name, "testing stuff")
|
|
984
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
985
|
+
|
|
986
|
+
def test_multiple_language_comments(self):
|
|
987
|
+
# -- LAST LANGUAGE is used.
|
|
988
|
+
doc = u"""
|
|
989
|
+
# language: en
|
|
990
|
+
# language: fr
|
|
991
|
+
Fonctionnalit\xe9: testing stuff
|
|
992
|
+
Oh my god, it's full of stuff...
|
|
993
|
+
"""
|
|
994
|
+
|
|
995
|
+
feature = parser.parse_feature(doc)
|
|
996
|
+
eq_(feature.name, "testing stuff")
|
|
997
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
998
|
+
|
|
999
|
+
def test_language_comment_wins_over_commandline(self):
|
|
1000
|
+
doc = u"""
|
|
1001
|
+
# language: fr
|
|
1002
|
+
Fonctionnalit\xe9: testing stuff
|
|
1003
|
+
Oh my god, it's full of stuff...
|
|
1004
|
+
"""
|
|
1005
|
+
|
|
1006
|
+
feature = parser.parse_feature(doc, language="de")
|
|
1007
|
+
eq_(feature.name, "testing stuff")
|
|
1008
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1009
|
+
|
|
1010
|
+
def test_whitespace_before_first_line_comment_still_sets_language(self):
|
|
1011
|
+
doc = u"""
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
# language: cs
|
|
1015
|
+
Po\u017eadavek: testing stuff
|
|
1016
|
+
Oh my god, it's full of stuff...
|
|
1017
|
+
"""
|
|
1018
|
+
|
|
1019
|
+
feature = parser.parse_feature(doc)
|
|
1020
|
+
eq_(feature.name, "testing stuff")
|
|
1021
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1022
|
+
|
|
1023
|
+
def test_anything_before_language_comment_makes_it_not_count(self):
|
|
1024
|
+
doc = u"""
|
|
1025
|
+
|
|
1026
|
+
@wombles
|
|
1027
|
+
# language: cy-GB
|
|
1028
|
+
Arwedd: testing stuff
|
|
1029
|
+
Oh my god, it's full of stuff...
|
|
1030
|
+
"""
|
|
1031
|
+
|
|
1032
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
1033
|
+
|
|
1034
|
+
def test_defaults_to_DEFAULT_LANGUAGE(self):
|
|
1035
|
+
feature_kwd = i18n.languages[parser.DEFAULT_LANGUAGE]['feature'][0]
|
|
1036
|
+
doc = u"""
|
|
1037
|
+
|
|
1038
|
+
@wombles
|
|
1039
|
+
# language: cs
|
|
1040
|
+
%s: testing stuff
|
|
1041
|
+
Oh my god, it's full of stuff...
|
|
1042
|
+
""" % feature_kwd
|
|
1043
|
+
|
|
1044
|
+
feature = parser.parse_feature(doc)
|
|
1045
|
+
eq_(feature.name, "testing stuff")
|
|
1046
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1047
|
+
|
|
1048
|
+
def test_whitespace_in_the_language_comment_is_flexible_1(self):
|
|
1049
|
+
doc = u"""
|
|
1050
|
+
#language:da
|
|
1051
|
+
Egenskab: testing stuff
|
|
1052
|
+
Oh my god, it's full of stuff...
|
|
1053
|
+
"""
|
|
1054
|
+
|
|
1055
|
+
feature = parser.parse_feature(doc)
|
|
1056
|
+
eq_(feature.name, "testing stuff")
|
|
1057
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1058
|
+
|
|
1059
|
+
def test_whitespace_in_the_language_comment_is_flexible_2(self):
|
|
1060
|
+
doc = u"""
|
|
1061
|
+
# language:de
|
|
1062
|
+
Funktionalit\xe4t: testing stuff
|
|
1063
|
+
Oh my god, it's full of stuff...
|
|
1064
|
+
"""
|
|
1065
|
+
|
|
1066
|
+
feature = parser.parse_feature(doc)
|
|
1067
|
+
eq_(feature.name, "testing stuff")
|
|
1068
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1069
|
+
|
|
1070
|
+
def test_whitespace_in_the_language_comment_is_flexible_3(self):
|
|
1071
|
+
doc = u"""
|
|
1072
|
+
#language: en-lol
|
|
1073
|
+
OH HAI: testing stuff
|
|
1074
|
+
Oh my god, it's full of stuff...
|
|
1075
|
+
"""
|
|
1076
|
+
|
|
1077
|
+
feature = parser.parse_feature(doc)
|
|
1078
|
+
eq_(feature.name, "testing stuff")
|
|
1079
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1080
|
+
|
|
1081
|
+
def test_whitespace_in_the_language_comment_is_flexible_4(self):
|
|
1082
|
+
doc = u"""
|
|
1083
|
+
# language: lv
|
|
1084
|
+
F\u012b\u010da: testing stuff
|
|
1085
|
+
Oh my god, it's full of stuff...
|
|
1086
|
+
"""
|
|
1087
|
+
|
|
1088
|
+
feature = parser.parse_feature(doc)
|
|
1089
|
+
eq_(feature.name, "testing stuff")
|
|
1090
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1091
|
+
|
|
1092
|
+
def test_parses_french(self):
|
|
1093
|
+
doc = u"""
|
|
1094
|
+
Fonctionnalit\xe9: testing stuff
|
|
1095
|
+
Oh my god, it's full of stuff...
|
|
1096
|
+
|
|
1097
|
+
Contexte:
|
|
1098
|
+
Soit I found some stuff
|
|
1099
|
+
|
|
1100
|
+
Sc\xe9nario: test stuff
|
|
1101
|
+
Soit I am testing stuff
|
|
1102
|
+
Alors it should work
|
|
1103
|
+
|
|
1104
|
+
Sc\xe9nario: test more stuff
|
|
1105
|
+
Soit I am testing stuff
|
|
1106
|
+
Alors it will work
|
|
1107
|
+
""".lstrip()
|
|
1108
|
+
feature = parser.parse_feature(doc, 'fr')
|
|
1109
|
+
eq_(feature.name, "testing stuff")
|
|
1110
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1111
|
+
assert(feature.background)
|
|
1112
|
+
self.compare_steps(feature.background.steps, [
|
|
1113
|
+
('given', 'Soit', 'I found some stuff', None, None),
|
|
1114
|
+
])
|
|
1115
|
+
|
|
1116
|
+
assert(len(feature.scenarios) == 2)
|
|
1117
|
+
eq_(feature.scenarios[0].name, 'test stuff')
|
|
1118
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
1119
|
+
('given', 'Soit', 'I am testing stuff', None, None),
|
|
1120
|
+
('then', 'Alors', 'it should work', None, None),
|
|
1121
|
+
])
|
|
1122
|
+
|
|
1123
|
+
def test_parses_french_multi_word(self):
|
|
1124
|
+
doc = u"""
|
|
1125
|
+
Fonctionnalit\xe9: testing stuff
|
|
1126
|
+
Oh my god, it's full of stuff...
|
|
1127
|
+
|
|
1128
|
+
Sc\xe9nario: test stuff
|
|
1129
|
+
Etant donn\xe9 I am testing stuff
|
|
1130
|
+
Alors it should work
|
|
1131
|
+
""".lstrip()
|
|
1132
|
+
feature = parser.parse_feature(doc, 'fr')
|
|
1133
|
+
eq_(feature.name, "testing stuff")
|
|
1134
|
+
eq_(feature.description, ["Oh my god, it's full of stuff..."])
|
|
1135
|
+
|
|
1136
|
+
assert(len(feature.scenarios) == 1)
|
|
1137
|
+
eq_(feature.scenarios[0].name, 'test stuff')
|
|
1138
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
1139
|
+
('given', u'Etant donn\xe9', 'I am testing stuff', None, None),
|
|
1140
|
+
('then', 'Alors', 'it should work', None, None),
|
|
1141
|
+
])
|
|
1142
|
+
test_parses_french_multi_word.go = 1
|
|
1143
|
+
|
|
1144
|
+
def test_properly_handles_whitespace_on_keywords_that_do_not_want_it(self):
|
|
1145
|
+
doc = u"""
|
|
1146
|
+
# language: zh-TW
|
|
1147
|
+
|
|
1148
|
+
\u529f\u80fd: I have no idea what I'm saying
|
|
1149
|
+
|
|
1150
|
+
\u5834\u666f: No clue whatsoever
|
|
1151
|
+
\u5047\u8a2dI've got no idea
|
|
1152
|
+
\u7576I say things
|
|
1153
|
+
\u800c\u4e14People don't understand
|
|
1154
|
+
\u90a3\u9ebcPeople should laugh
|
|
1155
|
+
\u4f46\u662fI should take it well
|
|
1156
|
+
"""
|
|
1157
|
+
|
|
1158
|
+
feature = parser.parse_feature(doc)
|
|
1159
|
+
eq_(feature.name, "I have no idea what I'm saying")
|
|
1160
|
+
|
|
1161
|
+
eq_(len(feature.scenarios), 1)
|
|
1162
|
+
eq_(feature.scenarios[0].name, 'No clue whatsoever')
|
|
1163
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
1164
|
+
('given', u'\u5047\u8a2d', "I've got no idea", None, None),
|
|
1165
|
+
('when', u'\u7576', 'I say things', None, None),
|
|
1166
|
+
('when', u'\u800c\u4e14', "People don't understand", None, None),
|
|
1167
|
+
('then', u'\u90a3\u9ebc', "People should laugh", None, None),
|
|
1168
|
+
('then', u'\u4f46\u662f', "I should take it well", None, None),
|
|
1169
|
+
])
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
class TestParser4ScenarioDescription(Common):
|
|
1173
|
+
|
|
1174
|
+
def test_parse_scenario_description(self):
|
|
1175
|
+
doc = u'''
|
|
1176
|
+
Feature: Scenario Description
|
|
1177
|
+
|
|
1178
|
+
Scenario: With scenario description
|
|
1179
|
+
|
|
1180
|
+
First line of scenario description.
|
|
1181
|
+
Second line of scenario description.
|
|
1182
|
+
|
|
1183
|
+
Third line of scenario description (after an empty line).
|
|
1184
|
+
|
|
1185
|
+
Given we have stuff
|
|
1186
|
+
When we do stuff
|
|
1187
|
+
Then we have things
|
|
1188
|
+
'''.lstrip()
|
|
1189
|
+
feature = parser.parse_feature(doc)
|
|
1190
|
+
eq_(feature.name, "Scenario Description")
|
|
1191
|
+
|
|
1192
|
+
assert(len(feature.scenarios) == 1)
|
|
1193
|
+
eq_(feature.scenarios[0].name, "With scenario description")
|
|
1194
|
+
eq_(feature.scenarios[0].tags, [])
|
|
1195
|
+
eq_(feature.scenarios[0].description, [
|
|
1196
|
+
"First line of scenario description.",
|
|
1197
|
+
"Second line of scenario description.",
|
|
1198
|
+
"Third line of scenario description (after an empty line).",
|
|
1199
|
+
])
|
|
1200
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
1201
|
+
('given', 'Given', 'we have stuff', None, None),
|
|
1202
|
+
('when', 'When', 'we do stuff', None, None),
|
|
1203
|
+
('then', 'Then', 'we have things', None, None),
|
|
1204
|
+
])
|
|
1205
|
+
|
|
1206
|
+
|
|
1207
|
+
def test_parse_scenario_with_description_but_without_steps(self):
|
|
1208
|
+
doc = u'''
|
|
1209
|
+
Feature: Scenario Description
|
|
1210
|
+
|
|
1211
|
+
Scenario: With description but without steps
|
|
1212
|
+
|
|
1213
|
+
First line of scenario description.
|
|
1214
|
+
Second line of scenario description.
|
|
1215
|
+
|
|
1216
|
+
Scenario: Another one
|
|
1217
|
+
Given we have stuff
|
|
1218
|
+
When we do stuff
|
|
1219
|
+
Then we have things
|
|
1220
|
+
'''.lstrip()
|
|
1221
|
+
feature = parser.parse_feature(doc)
|
|
1222
|
+
eq_(feature.name, "Scenario Description")
|
|
1223
|
+
|
|
1224
|
+
assert(len(feature.scenarios) == 2)
|
|
1225
|
+
eq_(feature.scenarios[0].name, "With description but without steps")
|
|
1226
|
+
eq_(feature.scenarios[0].tags, [])
|
|
1227
|
+
eq_(feature.scenarios[0].description, [
|
|
1228
|
+
"First line of scenario description.",
|
|
1229
|
+
"Second line of scenario description.",
|
|
1230
|
+
])
|
|
1231
|
+
eq_(feature.scenarios[0].steps, [])
|
|
1232
|
+
|
|
1233
|
+
eq_(feature.scenarios[1].name, "Another one")
|
|
1234
|
+
eq_(feature.scenarios[1].tags, [])
|
|
1235
|
+
eq_(feature.scenarios[1].description, [])
|
|
1236
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
1237
|
+
('given', 'Given', 'we have stuff', None, None),
|
|
1238
|
+
('when', 'When', 'we do stuff', None, None),
|
|
1239
|
+
('then', 'Then', 'we have things', None, None),
|
|
1240
|
+
])
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
def test_parse_scenario_with_description_but_without_steps_followed_by_scenario_with_tags(self):
|
|
1244
|
+
doc = u'''
|
|
1245
|
+
Feature: Scenario Description
|
|
1246
|
+
|
|
1247
|
+
Scenario: With description but without steps
|
|
1248
|
+
|
|
1249
|
+
First line of scenario description.
|
|
1250
|
+
Second line of scenario description.
|
|
1251
|
+
|
|
1252
|
+
@foo @bar
|
|
1253
|
+
Scenario: Another one
|
|
1254
|
+
Given we have stuff
|
|
1255
|
+
When we do stuff
|
|
1256
|
+
Then we have things
|
|
1257
|
+
'''.lstrip()
|
|
1258
|
+
feature = parser.parse_feature(doc)
|
|
1259
|
+
eq_(feature.name, "Scenario Description")
|
|
1260
|
+
|
|
1261
|
+
assert(len(feature.scenarios) == 2)
|
|
1262
|
+
eq_(feature.scenarios[0].name, "With description but without steps")
|
|
1263
|
+
eq_(feature.scenarios[0].tags, [])
|
|
1264
|
+
eq_(feature.scenarios[0].description, [
|
|
1265
|
+
"First line of scenario description.",
|
|
1266
|
+
"Second line of scenario description.",
|
|
1267
|
+
])
|
|
1268
|
+
eq_(feature.scenarios[0].steps, [])
|
|
1269
|
+
|
|
1270
|
+
eq_(feature.scenarios[1].name, "Another one")
|
|
1271
|
+
eq_(feature.scenarios[1].tags, ["foo", "bar"])
|
|
1272
|
+
eq_(feature.scenarios[1].description, [])
|
|
1273
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
1274
|
+
('given', 'Given', 'we have stuff', None, None),
|
|
1275
|
+
('when', 'When', 'we do stuff', None, None),
|
|
1276
|
+
('then', 'Then', 'we have things', None, None),
|
|
1277
|
+
])
|
|
1278
|
+
|
|
1279
|
+
def test_parse_two_scenarios_with_description(self):
|
|
1280
|
+
doc = u'''
|
|
1281
|
+
Feature: Scenario Description
|
|
1282
|
+
|
|
1283
|
+
Scenario: One with description but without steps
|
|
1284
|
+
|
|
1285
|
+
First line of scenario description.
|
|
1286
|
+
Second line of scenario description.
|
|
1287
|
+
|
|
1288
|
+
Scenario: Two with description and with steps
|
|
1289
|
+
|
|
1290
|
+
Another line of scenario description.
|
|
1291
|
+
|
|
1292
|
+
Given we have stuff
|
|
1293
|
+
When we do stuff
|
|
1294
|
+
Then we have things
|
|
1295
|
+
'''.lstrip()
|
|
1296
|
+
feature = parser.parse_feature(doc)
|
|
1297
|
+
eq_(feature.name, "Scenario Description")
|
|
1298
|
+
|
|
1299
|
+
assert(len(feature.scenarios) == 2)
|
|
1300
|
+
eq_(feature.scenarios[0].name, "One with description but without steps")
|
|
1301
|
+
eq_(feature.scenarios[0].tags, [])
|
|
1302
|
+
eq_(feature.scenarios[0].description, [
|
|
1303
|
+
"First line of scenario description.",
|
|
1304
|
+
"Second line of scenario description.",
|
|
1305
|
+
])
|
|
1306
|
+
eq_(feature.scenarios[0].steps, [])
|
|
1307
|
+
|
|
1308
|
+
eq_(feature.scenarios[1].name, "Two with description and with steps")
|
|
1309
|
+
eq_(feature.scenarios[1].tags, [])
|
|
1310
|
+
eq_(feature.scenarios[1].description, [
|
|
1311
|
+
"Another line of scenario description.",
|
|
1312
|
+
])
|
|
1313
|
+
self.compare_steps(feature.scenarios[1].steps, [
|
|
1314
|
+
('given', 'Given', 'we have stuff', None, None),
|
|
1315
|
+
('when', 'When', 'we do stuff', None, None),
|
|
1316
|
+
('then', 'Then', 'we have things', None, None),
|
|
1317
|
+
])
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
def parse_tags(line):
|
|
1321
|
+
the_parser = parser.Parser()
|
|
1322
|
+
return the_parser.parse_tags(line.strip())
|
|
1323
|
+
|
|
1324
|
+
class TestParser4Tags(Common):
|
|
1325
|
+
|
|
1326
|
+
def test_parse_tags_with_one_tag(self):
|
|
1327
|
+
tags = parse_tags('@one ')
|
|
1328
|
+
eq_(len(tags), 1)
|
|
1329
|
+
eq_(tags[0], "one")
|
|
1330
|
+
|
|
1331
|
+
def test_parse_tags_with_more_tags(self):
|
|
1332
|
+
tags = parse_tags('@one @two.three-four @xxx')
|
|
1333
|
+
eq_(len(tags), 3)
|
|
1334
|
+
eq_(tags, [model.Tag(name, 1)
|
|
1335
|
+
for name in (u'one', u'two.three-four', u'xxx' )])
|
|
1336
|
+
|
|
1337
|
+
def test_parse_tags_with_tag_and_comment(self):
|
|
1338
|
+
tags = parse_tags('@one # @fake-tag-in-comment xxx')
|
|
1339
|
+
eq_(len(tags), 1)
|
|
1340
|
+
eq_(tags[0], "one")
|
|
1341
|
+
|
|
1342
|
+
def test_parse_tags_with_tags_and_comment(self):
|
|
1343
|
+
tags = parse_tags('@one @two.three-four @xxx # @fake-tag-in-comment xxx')
|
|
1344
|
+
eq_(len(tags), 3)
|
|
1345
|
+
eq_(tags, [model.Tag(name, 1)
|
|
1346
|
+
for name in (u'one', u'two.three-four', u'xxx' )])
|
|
1347
|
+
|
|
1348
|
+
@raises(parser.ParserError)
|
|
1349
|
+
def test_parse_tags_with_invalid_tags(self):
|
|
1350
|
+
parse_tags('@one invalid.tag boom')
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
class TestParser4Background(Common):
|
|
1354
|
+
|
|
1355
|
+
def test_parse_background(self):
|
|
1356
|
+
doc = u'''
|
|
1357
|
+
Feature: Background
|
|
1358
|
+
|
|
1359
|
+
A feature description line 1.
|
|
1360
|
+
A feature description line 2.
|
|
1361
|
+
|
|
1362
|
+
Background: One
|
|
1363
|
+
Given we init stuff
|
|
1364
|
+
When we init more stuff
|
|
1365
|
+
|
|
1366
|
+
Scenario: One
|
|
1367
|
+
Given we have stuff
|
|
1368
|
+
When we do stuff
|
|
1369
|
+
Then we have things
|
|
1370
|
+
'''.lstrip()
|
|
1371
|
+
feature = parser.parse_feature(doc)
|
|
1372
|
+
eq_(feature.name, "Background")
|
|
1373
|
+
eq_(feature.description, [
|
|
1374
|
+
"A feature description line 1.",
|
|
1375
|
+
"A feature description line 2.",
|
|
1376
|
+
])
|
|
1377
|
+
assert feature.background is not None
|
|
1378
|
+
eq_(feature.background.name, "One")
|
|
1379
|
+
self.compare_steps(feature.background.steps, [
|
|
1380
|
+
('given', 'Given', 'we init stuff', None, None),
|
|
1381
|
+
('when', 'When', 'we init more stuff', None, None),
|
|
1382
|
+
])
|
|
1383
|
+
|
|
1384
|
+
assert(len(feature.scenarios) == 1)
|
|
1385
|
+
eq_(feature.scenarios[0].name, "One")
|
|
1386
|
+
eq_(feature.scenarios[0].tags, [])
|
|
1387
|
+
self.compare_steps(feature.scenarios[0].steps, [
|
|
1388
|
+
('given', 'Given', 'we have stuff', None, None),
|
|
1389
|
+
('when', 'When', 'we do stuff', None, None),
|
|
1390
|
+
('then', 'Then', 'we have things', None, None),
|
|
1391
|
+
])
|
|
1392
|
+
|
|
1393
|
+
|
|
1394
|
+
def test_parse_background_with_tags_should_fail(self):
|
|
1395
|
+
doc = u'''
|
|
1396
|
+
Feature: Background with tags
|
|
1397
|
+
Expect that a ParserError occurs
|
|
1398
|
+
because Background does not support tags/tagging.
|
|
1399
|
+
|
|
1400
|
+
@tags_are @not_supported
|
|
1401
|
+
@here
|
|
1402
|
+
Background: One
|
|
1403
|
+
Given we init stuff
|
|
1404
|
+
'''.lstrip()
|
|
1405
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
def test_parse_two_background_should_fail(self):
|
|
1409
|
+
doc = u'''
|
|
1410
|
+
Feature: Two Backgrounds
|
|
1411
|
+
Expect that a ParserError occurs
|
|
1412
|
+
because at most one Background is supported.
|
|
1413
|
+
|
|
1414
|
+
Background: One
|
|
1415
|
+
Given we init stuff
|
|
1416
|
+
|
|
1417
|
+
Background: Two
|
|
1418
|
+
When we init more stuff
|
|
1419
|
+
'''.lstrip()
|
|
1420
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
1421
|
+
|
|
1422
|
+
|
|
1423
|
+
def test_parse_background_after_scenario_should_fail(self):
|
|
1424
|
+
doc = u'''
|
|
1425
|
+
Feature: Background after Scenario
|
|
1426
|
+
Expect that a ParserError occurs
|
|
1427
|
+
because Background is only allowed before any Scenario.
|
|
1428
|
+
|
|
1429
|
+
Scenario: One
|
|
1430
|
+
Given we have stuff
|
|
1431
|
+
|
|
1432
|
+
Background: Two
|
|
1433
|
+
When we init more stuff
|
|
1434
|
+
'''.lstrip()
|
|
1435
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
1436
|
+
|
|
1437
|
+
|
|
1438
|
+
def test_parse_background_after_scenario_outline_should_fail(self):
|
|
1439
|
+
doc = u'''
|
|
1440
|
+
Feature: Background after ScenarioOutline
|
|
1441
|
+
Expect that a ParserError occurs
|
|
1442
|
+
because Background is only allowed before any ScenarioOuline.
|
|
1443
|
+
Scenario Outline: ...
|
|
1444
|
+
Given there is <name>
|
|
1445
|
+
|
|
1446
|
+
Examples:
|
|
1447
|
+
| name |
|
|
1448
|
+
| Alice |
|
|
1449
|
+
|
|
1450
|
+
Background: Two
|
|
1451
|
+
When we init more stuff
|
|
1452
|
+
'''.lstrip()
|
|
1453
|
+
assert_raises(parser.ParserError, parser.parse_feature, doc)
|
|
1454
|
+
|
|
1455
|
+
|
|
1456
|
+
class TestParser4Steps(Common):
|
|
1457
|
+
"""
|
|
1458
|
+
Tests parser.parse_steps() and parser.Parser.parse_steps() functionality.
|
|
1459
|
+
"""
|
|
1460
|
+
|
|
1461
|
+
def test_parse_steps_with_simple_steps(self):
|
|
1462
|
+
doc = u'''
|
|
1463
|
+
Given a simple step
|
|
1464
|
+
When I have another simple step
|
|
1465
|
+
And I have another simple step
|
|
1466
|
+
Then every step will be parsed without errors
|
|
1467
|
+
'''.lstrip()
|
|
1468
|
+
steps = parser.parse_steps(doc)
|
|
1469
|
+
eq_(len(steps), 4)
|
|
1470
|
+
# -- EXPECTED STEP DATA:
|
|
1471
|
+
# SCHEMA: step_type, keyword, name, text, table
|
|
1472
|
+
self.compare_steps(steps, [
|
|
1473
|
+
("given", "Given", "a simple step", None, None),
|
|
1474
|
+
("when", "When", "I have another simple step", None, None),
|
|
1475
|
+
("when", "And", "I have another simple step", None, None),
|
|
1476
|
+
("then", "Then", "every step will be parsed without errors",
|
|
1477
|
+
None, None),
|
|
1478
|
+
])
|
|
1479
|
+
|
|
1480
|
+
def test_parse_steps_with_multiline_text(self):
|
|
1481
|
+
doc = u'''
|
|
1482
|
+
Given a step with multi-line text:
|
|
1483
|
+
"""
|
|
1484
|
+
Lorem ipsum
|
|
1485
|
+
Ipsum lorem
|
|
1486
|
+
"""
|
|
1487
|
+
When I have a step with multi-line text:
|
|
1488
|
+
"""
|
|
1489
|
+
Ipsum lorem
|
|
1490
|
+
Lorem ipsum
|
|
1491
|
+
"""
|
|
1492
|
+
Then every step will be parsed without errors
|
|
1493
|
+
'''.lstrip()
|
|
1494
|
+
steps = parser.parse_steps(doc)
|
|
1495
|
+
eq_(len(steps), 3)
|
|
1496
|
+
# -- EXPECTED STEP DATA:
|
|
1497
|
+
# SCHEMA: step_type, keyword, name, text, table
|
|
1498
|
+
text1 = "Lorem ipsum\nIpsum lorem"
|
|
1499
|
+
text2 = "Ipsum lorem\nLorem ipsum"
|
|
1500
|
+
self.compare_steps(steps, [
|
|
1501
|
+
("given", "Given", "a step with multi-line text", text1, None),
|
|
1502
|
+
("when", "When", "I have a step with multi-line text", text2, None),
|
|
1503
|
+
("then", "Then", "every step will be parsed without errors",
|
|
1504
|
+
None, None),
|
|
1505
|
+
])
|
|
1506
|
+
|
|
1507
|
+
def test_parse_steps_when_last_step_has_multiline_text(self):
|
|
1508
|
+
doc = u'''
|
|
1509
|
+
Given a simple step
|
|
1510
|
+
Then the last step has multi-line text:
|
|
1511
|
+
"""
|
|
1512
|
+
Lorem ipsum
|
|
1513
|
+
Ipsum lorem
|
|
1514
|
+
"""
|
|
1515
|
+
'''.lstrip()
|
|
1516
|
+
steps = parser.parse_steps(doc)
|
|
1517
|
+
eq_(len(steps), 2)
|
|
1518
|
+
# -- EXPECTED STEP DATA:
|
|
1519
|
+
# SCHEMA: step_type, keyword, name, text, table
|
|
1520
|
+
text2 = "Lorem ipsum\nIpsum lorem"
|
|
1521
|
+
self.compare_steps(steps, [
|
|
1522
|
+
("given", "Given", "a simple step", None, None),
|
|
1523
|
+
("then", "Then", "the last step has multi-line text", text2, None),
|
|
1524
|
+
])
|
|
1525
|
+
|
|
1526
|
+
def test_parse_steps_with_table(self):
|
|
1527
|
+
doc = u'''
|
|
1528
|
+
Given a step with a table:
|
|
1529
|
+
| Name | Age |
|
|
1530
|
+
| Alice | 12 |
|
|
1531
|
+
| Bob | 23 |
|
|
1532
|
+
When I have a step with a table:
|
|
1533
|
+
| Country | Capital |
|
|
1534
|
+
| France | Paris |
|
|
1535
|
+
| Germany | Berlin |
|
|
1536
|
+
| Spain | Madrid |
|
|
1537
|
+
| USA | Washington |
|
|
1538
|
+
Then every step will be parsed without errors
|
|
1539
|
+
'''.lstrip()
|
|
1540
|
+
steps = parser.parse_steps(doc)
|
|
1541
|
+
eq_(len(steps), 3)
|
|
1542
|
+
# -- EXPECTED STEP DATA:
|
|
1543
|
+
# SCHEMA: step_type, keyword, name, text, table
|
|
1544
|
+
table1 = model.Table([u"Name", u"Age"], 0, [
|
|
1545
|
+
[ u"Alice", u"12" ],
|
|
1546
|
+
[ u"Bob", u"23" ],
|
|
1547
|
+
])
|
|
1548
|
+
table2 = model.Table([u"Country", u"Capital"], 0, [
|
|
1549
|
+
[ u"France", u"Paris" ],
|
|
1550
|
+
[ u"Germany", u"Berlin" ],
|
|
1551
|
+
[ u"Spain", u"Madrid" ],
|
|
1552
|
+
[ u"USA", u"Washington" ],
|
|
1553
|
+
])
|
|
1554
|
+
self.compare_steps(steps, [
|
|
1555
|
+
("given", "Given", "a step with a table", None, table1),
|
|
1556
|
+
("when", "When", "I have a step with a table", None, table2),
|
|
1557
|
+
("then", "Then", "every step will be parsed without errors",
|
|
1558
|
+
None, None),
|
|
1559
|
+
])
|
|
1560
|
+
|
|
1561
|
+
def test_parse_steps_when_last_step_has_a_table(self):
|
|
1562
|
+
doc = u'''
|
|
1563
|
+
Given a simple step
|
|
1564
|
+
Then the last step has a final table:
|
|
1565
|
+
| Name | City |
|
|
1566
|
+
| Alonso | Barcelona |
|
|
1567
|
+
| Bred | London |
|
|
1568
|
+
'''.lstrip()
|
|
1569
|
+
steps = parser.parse_steps(doc)
|
|
1570
|
+
eq_(len(steps), 2)
|
|
1571
|
+
# -- EXPECTED STEP DATA:
|
|
1572
|
+
# SCHEMA: step_type, keyword, name, text, table
|
|
1573
|
+
table2 = model.Table([u"Name", u"City"], 0, [
|
|
1574
|
+
[ u"Alonso", u"Barcelona" ],
|
|
1575
|
+
[ u"Bred", u"London" ],
|
|
1576
|
+
])
|
|
1577
|
+
self.compare_steps(steps, [
|
|
1578
|
+
("given", "Given", "a simple step", None, None),
|
|
1579
|
+
("then", "Then", "the last step has a final table", None, table2),
|
|
1580
|
+
])
|
|
1581
|
+
|
|
1582
|
+
@raises(parser.ParserError)
|
|
1583
|
+
def test_parse_steps_with_malformed_table(self):
|
|
1584
|
+
doc = u'''
|
|
1585
|
+
Given a step with a malformed table:
|
|
1586
|
+
| Name | City |
|
|
1587
|
+
| Alonso | Barcelona | 2004 |
|
|
1588
|
+
| Bred | London | 2010 |
|
|
1589
|
+
'''.lstrip()
|
|
1590
|
+
steps = parser.parse_steps(doc)
|