Skip to content

Commit 5ea2f43

Browse files
committed
Linting and formatting
1 parent c6b36fd commit 5ea2f43

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

terminusdb_client/tests/test_schema_overall.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,10 @@ class Doc(DocumentTemplate):
300300
# Call get_instances which should clean up dead refs
301301
instances = list(Doc.get_instances())
302302

303-
# Should only have live instances
304-
assert all(inst is not None for inst in instances)
303+
# Should have fewer instances after cleanup
304+
assert len(instances) < initial_count
305+
# doc1 should still be alive
306+
assert doc1 in instances
305307

306308
def test_to_dict_with_tagged_union(self):
307309
"""Test _to_dict with TaggedUnion inheritance"""
@@ -318,7 +320,7 @@ class ChildB(Base):
318320
_subdocument = []
319321

320322
# Create tagged union
321-
union = TaggedUnion(Base, [ChildA, ChildB])
323+
TaggedUnion(Base, [ChildA, ChildB])
322324

323325
# Create instance of child
324326
child = ChildA(type="A", field_a="value")
@@ -478,7 +480,7 @@ class Parent(GrandParent):
478480
class Child(Parent):
479481
child_prop: str
480482

481-
result = Child._to_dict()
483+
Child._to_dict()
482484

483485

484486
class TestEmbeddedRep:
@@ -631,7 +633,7 @@ def test_construct_schema_object(self):
631633
assert isinstance(person, type)
632634
assert person.__name__ == "Person"
633635
assert hasattr(person, "__annotations__")
634-
assert person.__annotations__["name"] == str
636+
assert person.__annotations__["name"] is str
635637

636638
def test_construct_nonexistent_type_error(self):
637639
"""Test _construct_class RuntimeError for non-existent type"""

terminusdb_client/tests/test_scripts.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ def test_startproject():
231231
)
232232

233233

234-
def test_startproject():
235-
"""Test project creation"""
234+
def test_startproject_basic():
235+
"""Test basic project creation"""
236236
runner = CliRunner()
237237
with runner.isolated_filesystem():
238238
result = runner.invoke(
@@ -954,7 +954,7 @@ def test_branch_delete_current():
954954
assert "Cannot delete main which is current branch" in str(result.exception)
955955

956956

957-
def test_branch_list():
957+
def test_branch_list_with_current_marked():
958958
"""Test branch listing with current branch marked"""
959959
runner = CliRunner()
960960
with runner.isolated_filesystem():
@@ -978,7 +978,7 @@ def test_branch_list():
978978
assert " dev" in result.output
979979

980980

981-
def test_branch_create():
981+
def test_branch_create_new():
982982
"""Test creating a new branch"""
983983
runner = CliRunner()
984984
with runner.isolated_filesystem():
@@ -1054,7 +1054,7 @@ def test_reset_soft():
10541054
assert "Soft reset to commit abc123" in result.output
10551055

10561056

1057-
def test_reset_hard():
1057+
def test_reset_hard_to_commit():
10581058
"""Test hard reset to a commit"""
10591059
runner = CliRunner()
10601060
with runner.isolated_filesystem():

terminusdb_client/tests/test_woql_coverage_increase.py

Whitespace-only changes.

terminusdb_client/tests/test_woql_query_overall.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ def test_special_methods(self):
542542
# immediately returns empty dict when called directly
543543
assert result == {}
544544

545-
def test_expand_value_variable_with_list(self):
546-
"""Test _expand_value_variable with list input"""
545+
def test_expand_value_variable_with_list_wrapping(self):
546+
"""Test _expand_value_variable with list input wrapping"""
547547
wq = WOQLQuery()
548548
input_list = ["v:item1", "v:item2", "literal_value"]
549549
result = wq._expand_value_variable(input_list)

terminusdb_client/tests/test_woql_type.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,10 @@ def test_from_woql_invalid_dict_type(self):
257257

258258
def test_from_woql_basic_string_types(self):
259259
"""Test basic string type conversions"""
260-
assert from_woql_type("xsd:string") == str
261-
assert from_woql_type("xsd:boolean") == bool
262-
assert from_woql_type("xsd:double") == float
263-
assert from_woql_type("xsd:integer") == int
260+
assert from_woql_type("xsd:string") is str
261+
assert from_woql_type("xsd:boolean") is bool
262+
assert from_woql_type("xsd:double") is float
263+
assert from_woql_type("xsd:integer") is int
264264

265265
# As string
266266
assert from_woql_type("xsd:string", as_str=True) == "str"

terminusdb_client/tests/test_woqldataframe.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def test_embed_obj_skips_xsd_types(self):
609609

610610
all_existing_class = {"Person": {"name": "xsd:string"}}
611611

612-
result = _embed_obj(df, 1, pd, False, all_existing_class, "Person", mock_client)
612+
_embed_obj(df, 1, pd, False, all_existing_class, "Person", mock_client)
613613

614614
# get_document should NOT have been called for xsd:string
615615
assert not mock_client.get_document.called
@@ -623,7 +623,7 @@ def test_embed_obj_skips_same_class(self):
623623

624624
all_existing_class = {"Person": {"name": "xsd:string", "friend": "Person"}}
625625

626-
result = _embed_obj(df, 1, pd, False, all_existing_class, "Person", mock_client)
626+
_embed_obj(df, 1, pd, False, all_existing_class, "Person", mock_client)
627627

628628
# get_document should NOT have been called for same class reference
629629
assert not mock_client.get_document.called
@@ -640,7 +640,7 @@ def test_embed_obj_skips_enum_types(self):
640640
"Status": {"@type": "Enum", "values": ["ACTIVE", "INACTIVE"]},
641641
}
642642

643-
result = _embed_obj(df, 1, pd, False, all_existing_class, "Person", mock_client)
643+
_embed_obj(df, 1, pd, False, all_existing_class, "Person", mock_client)
644644

645645
# get_document should NOT have been called for Enum type
646646
assert not mock_client.get_document.called

0 commit comments

Comments
 (0)