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

BUG: MapCombined documentation different traceback #205

Open
msftcangoblowm opened this issue Feb 5, 2024 · 0 comments
Open

BUG: MapCombined documentation different traceback #205

msftcangoblowm opened this issue Feb 5, 2024 · 0 comments

Comments

@msftcangoblowm
Copy link

Environment:

  • py39 (3.9.16)
  • strictyaml: 1.7.3

strictyaml.MapCombined docs show a different traceback

Straight from the documentation

from strictyaml import Any, Int, MapCombined, Optional, Str, load

schema = MapCombined(
  {
    "required": Str(),
    Optional("foo"): Int(),
  },
  Str(),
  Any(),
)

yaml_snippet = """1: Hello World
not_an_integer: 42"""

load(yaml_snippet, schema)

Expected (shown in docs)

strictyaml.exceptions.YAMLValidationError:
when expecting an integer
found arbitrary text
in "", line 2, column 1:
not_an_integer: '42'
^ (line: 2)

Actual

strictyaml.exceptions.YAMLValidationError: while parsing a mapping
in "", line 1, column 1:
'1': Hello World
^ (line: 1)
required key(s) 'required' not found
in "", line 2, column 1:
not_an_integer: '42'
^ (line: 2)

Recommended action

  • Confirm
  • Update the docs (story)

The bigger question: How can the docs (story) be wrong?

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

No branches or pull requests

1 participant