Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topotato: Regex Json Compare Directive #134

Open
wants to merge 3 commits into
base: topotato-base
Choose a base branch
from

Conversation

eznix86
Copy link

@eznix86 eznix86 commented Sep 14, 2023

Usage:

compare = {
   "item": JsonCompareRegex(r"\s+"),
   "item1": JsonCompareRegex(r"\d+"),
   "item2": JsonCompareRegex("[A-Z]+"),
   "item3": JsonCompareRegex(r"^%?FRRouting/")
}

Example of errors:

E       topotato.exceptions.TopotatoCLICompareFail: json["item"] dict value is different (
E       1 vs regex '\\s+')
E       topotato.exceptions.TopotatoCLICompareFail: json["item1"] dict value is different (
E       abcd vs regex '\\d+')

Signed-off-by: Bruno Bernard <contact.brunobernard@gmail.com>
…to import

Signed-off-by: Bruno Bernard <contact.brunobernard@gmail.com>
topotato/utils.py Outdated Show resolved Hide resolved
…ng JSONCompareRegex

Signed-off-by: Bruno Bernard <contact.brunobernard@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants