79429262

Date: 2025-02-11 08:12:07
Score: 1
Natty:
Report link

I think nowadays if unittest.TestCase is used, we could use assertDictEqual() to compare pydantic models (which can be turned into dict):

class TestPydanticModels(unittest.TestCase):

def test_models_equal(self):
    self.assertDictEqual(
       model1.model_dump(),
       model2.model_dump()
    )
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Jinnan Gong