Skip to content

Commit

Permalink
Fix test_numeric_values of the show test (#8644)
Browse files Browse the repository at this point in the history
(cherry picked from commit 26c7675)
  • Loading branch information
gshank authored and github-actions[bot] committed Sep 13, 2023
1 parent 8232feb commit 5bd40d2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20230913-141651.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Fix test_numeric_values to look for more specific strings
time: 2023-09-13T14:16:51.453247-04:00
custom:
Author: gshank
Issue: "8470"
28 changes: 16 additions & 12 deletions tests/functional/show/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ def test_numeric_values(self, project):
(_, log_output) = run_dbt_and_capture(
["show", "--select", "sample_number_model", "--output", "json"]
)
# json log output needs the escapes removed for string matching
log_output = log_output.replace("\\", "")
assert "Previewing node 'sample_number_model'" not in log_output
assert "1.0" not in log_output
assert "1" in log_output
assert "3.0" in log_output
assert "4.3" in log_output
assert "5" in log_output
assert "5.0" not in log_output
assert '"float_to_int_field": 1.0' not in log_output
assert '"float_to_int_field": 1' in log_output
assert '"float_field": 3.0' in log_output
assert '"float_with_dec_field": 4.3' in log_output
assert '"int_field": 5' in log_output
assert '"int_field": 5.0' not in log_output


class TestShowNumericNulls(ShowBase):
Expand All @@ -97,13 +99,15 @@ def test_numeric_values_with_nulls(self, project):
(_, log_output) = run_dbt_and_capture(
["show", "--select", "sample_number_model_with_nulls", "--output", "json"]
)
# json log output needs the escapes removed for string matching
log_output = log_output.replace("\\", "")
assert "Previewing node 'sample_number_model_with_nulls'" not in log_output
assert "1.0" not in log_output
assert "1" in log_output
assert "3.0" in log_output
assert "4.3" in log_output
assert "5" in log_output
assert "5.0" not in log_output
assert '"float_to_int_field": 1.0' not in log_output
assert '"float_to_int_field": 1' in log_output
assert '"float_field": 3.0' in log_output
assert '"float_with_dec_field": 4.3' in log_output
assert '"int_field": 5' in log_output
assert '"int_field": 5.0' not in log_output


class TestShowInline(ShowBase):
Expand Down

0 comments on commit 5bd40d2

Please sign in to comment.