Skip to content

Commit 5f3e229

Browse files
fix tests; fix format
1 parent d7ee92c commit 5f3e229

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

tests/lsp/test_reference_macro_find_all.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,32 @@ def test_find_all_references_for_macro_add_one():
4747
expected_ranges = [
4848
# Macro definition in utils.py
4949
{
50-
"uri": "file:///Users/themistoklisvaltinos/Developer/sqlmesh/examples/sushi/macros/utils.py",
50+
"uri_file": "utils.py",
5151
"range": ((6, 0), (9, 22)),
5252
},
5353
# Usage in customers.sql
5454
{
55-
"uri": "file:///Users/themistoklisvaltinos/Developer/sqlmesh/examples/sushi/models/customers.sql",
55+
"uri_file": "customers.sql",
5656
"range": ((36, 7), (36, 14)),
5757
},
5858
# Usage in top_waiters.sql
5959
{
60-
"uri": "file:///Users/themistoklisvaltinos/Developer/sqlmesh/examples/sushi/models/top_waiters.sql",
60+
"uri_file": "top_waiters.sql",
6161
"range": ((12, 5), (12, 12)),
6262
},
6363
]
6464

6565
for expected in expected_ranges:
6666
assert any(
67-
ref.uri == expected["uri"] and
68-
ref.range.start.line == expected["range"][0][0] and
69-
ref.range.start.character == expected["range"][0][1] and
70-
ref.range.end.line == expected["range"][1][0] and
71-
ref.range.end.character == expected["range"][1][1]
67+
expected["uri_file"] in ref.uri
68+
and ref.range.start.line == expected["range"][0][0]
69+
and ref.range.start.character == expected["range"][0][1]
70+
and ref.range.end.line == expected["range"][1][0]
71+
and ref.range.end.character == expected["range"][1][1]
7272
for ref in all_references
73-
), f"Expected reference with uri {expected['uri']} and range {expected['range']} not found"
73+
), (
74+
f"Expected reference with uri {expected['uri_file']} and range {expected['range']} not found"
75+
)
7476

7577

7678
def test_find_all_references_for_macro_multiply():
@@ -171,8 +173,7 @@ def test_multi_repo_macro_references():
171173
# Click on the second macro reference which appears under the same name in repo_1 ('dup')
172174
first_ref = macro_references[1]
173175
position = Position(
174-
line=first_ref.range.start.line,
175-
character=first_ref.range.start.character + 1
176+
line=first_ref.range.start.line, character=first_ref.range.start.character + 1
176177
)
177178
all_references = get_macro_find_all_references(lsp_context, d_uri, position)
178179

@@ -183,4 +184,6 @@ def test_multi_repo_macro_references():
183184
assert any("repo_2" in ref.uri for ref in all_references), "Should find macro in repo_2"
184185

185186
# But not references in repo_1 since despite identical name they're different macros
186-
assert not any("repo_1" in ref.uri for ref in all_references), "Shouldn't find macro in repo_1"
187+
assert not any("repo_1" in ref.uri for ref in all_references), (
188+
"Shouldn't find macro in repo_1"
189+
)

0 commit comments

Comments
 (0)