Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
bundle:
name: my_project

sync: {paths: []} # don't need to copy files

python:
resources:
- "resources:load_resources"

variables:
id:
default: 42

# Each target sets a different default for var.id.
targets:
int:
default: true
# YAML reads a leading-zero value containing 8 or 9 as a float.
leading_zero:
variables:
id: 0012345678901234
float_whole:
variables:
id: 1.0
exponent:
variables:
id: 1e3
float_fraction:
variables:
id: 3.10
complex:
variables:
id:
nested: 1.0
# A whole float beyond int64 comes back from Python as an int we can't parse.
huge:
variables:
id: 0012345678901234567890
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Cloud = false
EnvMatrix.DMS = ["", "true"]
EnvMatrix.PYDAB_VERSION = ["0.266.0", "current"]
55 changes: 55 additions & 0 deletions acceptance/bundle/python/numeric-variable-default/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

=== int

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t int --output json
{"default":42,"value":42}

=== leading_zero

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t leading_zero --output json
Error: internal error when merging output of Python mutator: unexpected change at "variables.id.default" (update)


Exit code: 1
{"default":12345678901234,"value":12345678901234}

=== float_whole

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t float_whole --output json
Error: internal error when merging output of Python mutator: unexpected change at "variables.id.default" (update)


Exit code: 1
{"default":1,"value":1}

=== exponent

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t exponent --output json
Error: internal error when merging output of Python mutator: unexpected change at "variables.id.default" (update)


Exit code: 1
{"default":1000,"value":1000}

=== float_fraction

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t float_fraction --output json
{"default":3.1,"value":3.1}

=== complex

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t complex --output json
Error: internal error when merging output of Python mutator: unexpected change at "variables.id.default.nested" (update)


Exit code: 1
{"default":{"nested":1},"value":{"nested":1}}

=== huge

>>> uv run [UV_ARGS] -q [CLI] bundle validate -t huge --output json
Error: failed to parse output file: yaml ([TEST_TMP_DIR]/__generated_by_python__.yml:[POS]): invalid int value: 12345678901234567000


Exit code: 1
{"default":12345678901234567000,"value":12345678901234567000}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from databricks.bundles.core import Bundle, Resources


def load_resources(bundle: Bundle) -> Resources:
return Resources()
7 changes: 7 additions & 0 deletions acceptance/bundle/python/numeric-variable-default/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
for target in int leading_zero float_whole exponent float_fraction complex huge; do
title "$target"
errcode trace uv run $UV_ARGS -q $CLI bundle validate -t $target --output json > tmp.json
jq -c .variables.id tmp.json
done

rm -fr .databricks __pycache__ tmp.json
4 changes: 4 additions & 0 deletions acceptance/bundle/python/numeric-variable-default/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The column depends on the size of the Python output, which includes paths.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Generated] The golden records an internal error as the expected output, but nothing marks it as a bug. Add a Badness = "..." line above [[Repls]], as validate/yaml_duplicate_keys/shadowed_invalid_subtree/test.toml does?

[[Repls]]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] The script removes .databricks, __pycache__, and tmp.json with rm -fr (script line 7) instead of declaring them in Ignore. The testing rules require Ignore for test artifacts. Add Ignore = [".databricks", "__pycache__", "tmp.json"] here and drop the rm -fr line from script.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI Generated] Major: On Windows loadOutput builds this path with filepath.Join, so the huge error reads [TEST_TMP_DIR]\__generated_by_python__.yml and won't match the golden. Can you add the '\\' → / Repl from bundle/validate/yaml_anchors/test.toml?

Old = '__generated_by_python__\.yml:\d+:\d+'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test fails on Windows because the path separator before __generated_by_python__.yml is a backslash there. Could the replacement cover the separator too?

New = '__generated_by_python__.yml:[POS]'
Loading