Skip to content

BUG: MapCombined documentation different traceback #205

Description

@msftcangoblowm

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions