Skip to main content

cuke4behave

What is this.

There is a popular bdd library in python, Behave. Cucumber Expressions are areplacement for regexs in Gherkin codebases. in large swaths of Behave implementations. Cucumber also has a good language server and vscode extension. To support both, this library allows you to inject a new step matcher into Behave, for use with more modern Gherkin paradigms.

Installation

Pip:

pip install cuke4behave

Poetry:

poetry install cuke4behave

Usage

from cuke4behave import build_step_matcher


from behave import given, then, when
from behave.matchers import matcher_mapping, use_step_matcher

from cucumber_expressions.parameter_type import ParameterType
from cucumber_expressions.parameter_type_registry import ParameterTypeRegistry

from cuke4behave.step_matcher import build_step_matcher
from features.steps.helpers import Color, full_add

# Build a ParameterType and ParameterTypeRegistry
color_ptr = ParameterType(
    "color",
    "red|blue|orange|purple|brown",
    Color,
    lambda s: Color(s),
    use_for_snippets="",
    prefer_for_regexp_match=False,
)
ptr = ParameterTypeRegistry()
# do this as many times as necessary
ptr.define_parameter_type(color_ptr)

# step matcher to pass to behave
step_matcher = build_step_matcher(ptr)

# THIS IS IMPORTANT. Patch in the step matcher to behave
matcher_mapping["cucumber_expressions"] = step_matcher

use_step_matcher("cucumber_expressions")

`

Metadata

Release files for cuke4behave 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cuke4behave 0.1.3
File Size Uploaded Provenance Actions
cuke4behave-0.1.3.tar.gz 3.7 kB Without provenance Details for cuke4behave-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cuke4behave 0.1.3
File Interpreter ABI Platform Actions
cuke4behave-0.1.3-py3-none-any.whl Python 3 none any Details for cuke4behave-0.1.3-py3-none-any.whl

Total release size: 7.4 kB

Release files / cuke4behave-0.1.3.tar.gz

Download URL cuke4behave-0.1.3.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d104a23fb4a85cacd2b5972dc5ee50ed95146aee732831b79b2f64e57ab71c7f
BLAKE2b-256 checksum
How to use checksums
b8d938e1f8d0f60a0ccdc63d05d2694db25c029d62254efe53c0f6c4375de90f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.7 Linux/5.19.11-arch1-1

Release files / cuke4behave-0.1.3-py3-none-any.whl

Download URL cuke4behave-0.1.3-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bc68b313bbcee2fcabd0c993c27e07cb04389a9317e31dcf8fc6e028a64de963
BLAKE2b-256 checksum
How to use checksums
4bc4c71f7f6b302220339ca44ceeb80f6e7d7b84735cae5187365936413e56fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.7 Linux/5.19.11-arch1-1

Security for cuke4behave 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page