CoolFace
Apppublic

mlnsio/text2sql

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
test_models.py43 linesDownload Raw Back to core
1from django.test import TestCase2from core.models import MutualFund3 4 5class TestMutualFund(TestCase):6    def test_model_creation(self):7        # Create a new MutualFund instance8        mutual_fund1 = MutualFund(9            fund_name="Test Fund 1",10            isin_number="123456789012",11            security_id="MST01234",12            data={13                "details": {14                    "legalName": "Test Fund 1",15                    "isin": "123456789012",16                    "secId": "MST01234",17                }18            },19        )20 21        # Save the MutualFund instance to the database22        mutual_fund1.save()23 24        # Check if the MutualFund instance was saved successfully25        self.assertEqual(MutualFund.objects.count(), 1)26 27        mutual_fund2 = MutualFund(28            fund_name="Test Fund 2",29            isin_number="9876543210",30            security_id="MST56789",31            data={32                "details": {33                    "legalName": "Test Fund 2",34                    "isin": "9876543210",35                    "secId": "MST56789",36                }37            },38        )39        mutual_fund2.save()40 41        self.assertNotEqual(mutual_fund1.id, mutual_fund2.id)42        self.assertEqual(MutualFund.objects.count(), 2)43