Skip to content
Testaroo
yaml640 B

YAML Indentation Variants

The indentation styles that all parse identically and that formatters fight over: sequences flush with their key versus indented under it, two-space against four-space maps, and deliberately irregular but legal nesting. For testing formatters and idempotency.

Preview, first 37 linesyaml
# Indentation variants. All of these are valid YAML; linters and formatters disagree about which
# to enforce, and a rewriter that normalises them changes bytes without changing meaning — which
# matters when the file is under review or checksum.
sequence_flush_with_key:
- one
- two

sequence_indented_under_key:
  - one
  - two

map_two_space:
  a: 1
  b: 2

map_four_space:
    a: 1
    b: 2

irregular_but_legal:
      deeply:
            nested: value

sequence_of_maps_flush:
- name: build
  needs: []
- name: test
  needs:
  - build

sequence_of_maps_indented:
  - name: build
    needs: []
  - name: test
    needs:
      - build

Specifications

Sequence Indent Styles
2
Map Indent Widths
3
Irregular But Legal Nesting
1
Edge Case
all variants are valid; formatters disagree about which to enforce

Testing contract

Expected to pass
Scenario
Confirm that differently indented YAML loads to identical data before reformatting it
Expected result
sequence_flush_with_key and sequence_indented_under_key load to equal lists, and reformatting the file twice produces byte-identical output the second time

What is a .yaml file?

YAML (YAML Ain't Markup Language) is a human-readable data-serialization format using indentation, key-value pairs, and lists, and is a superset of JSON. It supports comments, anchors, and multiple documents per file, favoring readability for configuration. Its indentation sensitivity makes it error-prone to hand-edit.

How to use this file

Use an example YAML file to test config parsers, indentation and anchor handling, multi-document streams, and safe-loading to avoid arbitrary object construction.

How to use this file for testing

“YAML Indentation Variants” is a deterministic Testaroo fixture for Config parsing, Encoding detection, Editor testing. TOML and INI configuration files with nested sections and typed values, for testing config parsers and loaders.

Documented properties for this file: YAML · 640 bytes. Compare results against paired or grouped companions on this page when present (clean↔damaged, searchable↔scanned, or format twins) so scores stay reproducible across runs.

Download the file once, keep the path stable in CI or local scripts, and treat the spec table as the contract: dimensions, seeds, field lists, and roles are intentional. Corrupt or invalid samples are labelled as such, expect parsers to fail loudly rather than silently accept them.

Pipeline and infrastructure fixtures are inert configuration: steps reference fictional images and scripts, and nothing here executes. Run your linter, schema validator, migrator, or policy engine against them, and expect the deprecated-syntax and intentionally invalid variants to be rejected.

Point your config loader at the file and assert it reads the documented sections and typed values, including any deliberately-tricky nesting or comments.

Code examples

import yaml  # pip install pyyaml

with open("indentation-variants.yaml") as f:
    data = yaml.safe_load(f)
print(data)

Generated by generation/pipelines.py. Free for any use, no attribution required, license.