You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ossie.apache.org by jb...@apache.org on 2026/07/20 06:46:54 UTC

(ossie) branch main updated: Check in snapshot files for consistent testing (#231)

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ossie.git


The following commit(s) were added to refs/heads/main by this push:
     new 3db13b4  Check in snapshot files for consistent testing (#231)
3db13b4 is described below

commit 3db13b4ea02deb293082a1c042b9cd8a12f51965
Author: Yong Zheng <yo...@gmail.com>
AuthorDate: Mon Jul 20 01:46:49 2026 -0500

    Check in snapshot files for consistent testing (#231)
    
    * Checkin snapshot files for consistent testing
    
    * Add header to ambr files
    
    * Keep syrupy snapshots command
---
 converters/dbt/README.md                           |   3 +-
 .../dbt/tests/__snapshots__/test_msi_to_osi.ambr   | 200 +++++++++++++++++++++
 .../dbt/tests/__snapshots__/test_osi_to_msi.ambr   |  65 +++++++
 3 files changed, 266 insertions(+), 2 deletions(-)

diff --git a/converters/dbt/README.md b/converters/dbt/README.md
index e78663e..c39090f 100644
--- a/converters/dbt/README.md
+++ b/converters/dbt/README.md
@@ -134,8 +134,7 @@ uv sync
 uv run pytest
 ```
 
-Generate initial syrupy snapshots on first run:
-
+Generate new Syrupy snapshots:
 ```bash
 uv run pytest --snapshot-update
 ```
diff --git a/converters/dbt/tests/__snapshots__/test_msi_to_osi.ambr b/converters/dbt/tests/__snapshots__/test_msi_to_osi.ambr
new file mode 100644
index 0000000..facd135
--- /dev/null
+++ b/converters/dbt/tests/__snapshots__/test_msi_to_osi.ambr
@@ -0,0 +1,200 @@
+# serializer version: 1
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# name: TestMetricConversion.test_derived_metric_nested
+  '''
+  version: 0.2.0.dev0
+  dialects:
+  - ANSI_SQL
+  semantic_model:
+  - name: semantic_model
+    datasets:
+    - name: orders
+      source: schema.table
+      fields:
+      - name: revenue
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: amount
+      - name: cost
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: cost_amount
+      - name: expenses
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: expense_amount
+    metrics:
+    - name: revenue
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(orders.amount)
+    - name: cost
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(orders.cost_amount)
+    - name: expenses
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(orders.expense_amount)
+    - name: gross_profit
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(orders.amount) - SUM(orders.cost_amount)
+    - name: net_profit
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: (SUM(orders.amount) - SUM(orders.cost_amount)) - SUM(orders.expense_amount)
+  
+  '''
+# ---
+# name: TestMetricConversion.test_ratio_metric_inlines_sub_expressions
+  '''
+  version: 0.2.0.dev0
+  dialects:
+  - ANSI_SQL
+  semantic_model:
+  - name: semantic_model
+    datasets:
+    - name: orders
+      source: schema.table
+      fields:
+      - name: revenue
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: amount
+      - name: order_count
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: CASE WHEN order_id IS NOT NULL THEN 1 ELSE 0 END
+    metrics:
+    - name: revenue
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(orders.amount)
+    - name: order_count
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(CASE WHEN orders.order_id IS NOT NULL THEN 1 ELSE 0 END)
+    - name: arpu
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: (SUM(orders.amount)) / (SUM(CASE WHEN orders.order_id IS NOT NULL
+            THEN 1 ELSE 0 END))
+  
+  '''
+# ---
+# name: TestMetricFilterFlattening.test_metric_and_measure_filters_combined_with_and
+  '''
+  version: 0.2.0.dev0
+  dialects:
+  - ANSI_SQL
+  semantic_model:
+  - name: semantic_model
+    datasets:
+    - name: orders
+      source: schema.table
+      fields:
+      - name: revenue
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: amount
+    metrics:
+    - name: paid_intl_revenue
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(CASE WHEN (status = 'paid') AND (region = 'intl') THEN orders.amount
+            END)
+  
+  '''
+# ---
+# name: TestRelationshipConversion.test_three_datasets_produce_all_pairs
+  '''
+  version: 0.2.0.dev0
+  dialects:
+  - ANSI_SQL
+  semantic_model:
+  - name: semantic_model
+    datasets:
+    - name: users_a
+      source: schema.table
+      primary_key:
+      - user_id
+      fields:
+      - name: user
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: user_id
+    - name: users_b
+      source: schema.table
+      unique_keys:
+      - - user_id
+      fields:
+      - name: user
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: user_id
+    - name: orders
+      source: schema.table
+      fields:
+      - name: user
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: user_id
+    relationships:
+    - name: users_a__users_b__user
+      from: users_a
+      to: users_b
+      from_columns:
+      - user_id
+      to_columns:
+      - user_id
+    - name: orders__users_a__user
+      from: orders
+      to: users_a
+      from_columns:
+      - user_id
+      to_columns:
+      - user_id
+    - name: orders__users_b__user
+      from: orders
+      to: users_b
+      from_columns:
+      - user_id
+      to_columns:
+      - user_id
+  
+  '''
+# ---
diff --git a/converters/dbt/tests/__snapshots__/test_osi_to_msi.ambr b/converters/dbt/tests/__snapshots__/test_osi_to_msi.ambr
new file mode 100644
index 0000000..e886e0b
--- /dev/null
+++ b/converters/dbt/tests/__snapshots__/test_osi_to_msi.ambr
@@ -0,0 +1,65 @@
+# serializer version: 1
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# name: TestOSIToMSIRoundTrip.test_osi_to_msi_to_osi_preserves_structure
+  '''
+  version: 0.2.0.dev0
+  dialects:
+  - ANSI_SQL
+  semantic_model:
+  - name: semantic_model
+    datasets:
+    - name: orders
+      source: analytics.orders
+      primary_key:
+      - order_id
+      fields:
+      - name: order_id
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: order_id
+      - name: status
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: status
+        dimension:
+          is_time: false
+      - name: created_at
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: created_at
+        dimension:
+          is_time: true
+      - name: amount
+        expression:
+          dialects:
+          - dialect: ANSI_SQL
+            expression: amount
+        dimension:
+          is_time: false
+    metrics:
+    - name: revenue
+      expression:
+        dialects:
+        - dialect: ANSI_SQL
+          expression: SUM(orders.amount)
+  
+  '''
+# ---