Skip to content

Commit

Permalink
unit test unparsed version lt
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk committed Sep 6, 2023
1 parent 874ee1c commit acc761e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/unit/test_contracts_graph_unparsed.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pickle
from datetime import timedelta
import pickle
import pytest

from dbt.contracts.graph.unparsed import (
UnparsedNode,
Expand Down Expand Up @@ -928,3 +929,25 @@ def test_bad_version_no_v(self):
version = self.get_ok_dict()
del version["v"]
self.assert_fails_validation(version)


@pytest.mark.parametrize(
"left,right,expected_lt",
[
# same types
(2, 12, True),
(12, 2, False),
("a", "b", True),
("b", "a", False),
# mismatched types - numeric
(2, 12.0, True),
(12.0, 2, False),
(2, "12", True),
("12", 2, False),
# mismatched types
(1, "test", True),
("test", 1, False),
],
)
def test_unparsed_version_lt(left, right, expected_lt):
assert (UnparsedVersion(left) < UnparsedVersion(right)) == expected_lt

0 comments on commit acc761e

Please sign in to comment.