Skip to content

Commit 2ddeeeb

Browse files
committed
adapt coderabbit comment about adding explict assertion of trainer init in UT
1 parent ab15c73 commit 2ddeeeb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

source/tests/pt/test_init_frz_model.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,18 @@ def test_init_frz_model_pb2pth(self) -> None:
159159
config["training"]["numb_steps"] = 0
160160

161161
trainer = get_trainer(config, init_frz_model=frozen_model)
162+
# Explicit assertions to make test success criteria clear
163+
self.assertIsNotNone(trainer, "Trainer should be successfully initialized")
164+
self.assertTrue(
165+
hasattr(trainer, "model"), "Trainer should have a model attribute"
166+
)
167+
self.assertTrue(
168+
hasattr(trainer, "optimizer"), "Trainer should have an optimizer attribute"
169+
)
170+
# Run the trainer (this would fail if initialization was incorrect)
162171
trainer.run()
172+
# Verify the model was properly initialized from the frozen model
173+
self.assertIsNotNone(trainer.model, "Model should be properly initialized")
163174

164175
def tearDown(self) -> None:
165176
for f in os.listdir("."):

0 commit comments

Comments
 (0)