Repository: oppia/oppia
File: core/jobs/batch_jobs/user_bios_change_jobs_test.py (Python)

Code before:
    def test_empty_storage(self) -> None:
        self.assert_job_output_is_empty()

    def test_user_with_null_bio(self) -> None:
        user = self.create_model(
            user_models.UserSettingsModel,
            id=self.USER_ID_1,
            username=self.USER_USERNAME_1,
            email='a@a.com',
            user_bio=None,
        )
        user.update_timestamps()
        self.put_multi([user])

        self.assert_job_output_is([
            job_run_result.JobRunResult(
                stdout=f"""Test Output - Username: {self.USER_USERNAME_1}, New Bio: """), # pylint: disable=line-too-long
        ])
        user_setting_model = user_models.UserSettingsModel.get_by_email(
            'a@a.com')
        self.assertIsNotNone(
            user_setting_model,
            """retrieve user_setting model is None"""
        )
        assert user_setting_model is not None
        self.assertTrue(
            isinstance(user_setting_model.user_bio, str),
            """user_bio is not type of string"""
        )

    def test_user_with_short_bio(self) -> None:
        user = self.create_model(
            user_models.UserSettingsModel,
            id=self.USER_ID_2,
            username=self.USER_USERNAME_2,
            email='b@b.com',
            user_bio='Test Bio'
        )
        user.update_timestamps()
        self.put_multi([user])

        self.assert_job_output_is_empty()
        user_setting_model = user_models.UserSettingsModel.get_by_email(
            'b@b.com')
        assert user_setting_model is not None
        self.assertEqual(
            user_setting_model.user_bio,
            user.user_bio,
            """user_bio is not same as expected"""
        )


Review comment (bug):
Please make sure not to use the wrong help text, it initiates the confusion around the changes. Please correct here and elsewhere.
This was the case in your previous prs as well, please make sure to follow the review comments in your future changes.
Thanks

Code after:

    def test_user_with_null_bio(self) -> None:
        user = self.create_model(
            user_models.UserSettingsModel,
            id=self.USER_ID_1,
            username=self.USER_USERNAME_1,
            email='a@a.com',
            user_bio=None,
        )
        user.update_timestamps()
        self.put_multi([user])

        self.assert_job_output_is([
            job_run_result.JobRunResult(
                stdout=f"""Test Output - Username: {self.USER_USERNAME_1}, New Bio: """), # pylint: disable=line-too-long
        ])
        user_setting_model = user_models.UserSettingsModel.get_by_email(
            'a@a.com')
        self.assertIsNotNone(
            user_setting_model,
            """retrieve user_setting model is None"""
        )
        assert user_setting_model is not None
        self.assertTrue(
            isinstance(user_setting_model.user_bio, str),
            """user_bio is not type of string"""
        )

    def test_user_with_not_null_bio(self) -> None:
        user = self.create_model(
            user_models.UserSettingsModel,
            id=self.USER_ID_2,
            username=self.USER_USERNAME_2,
            email='b@b.com',
            user_bio='Test Bio'
        )
        user.update_timestamps()
        self.put_multi([user])

        self.assert_job_output_is_empty()
        user_setting_model = user_models.UserSettingsModel.get_by_email(
            'b@b.com')
        assert user_setting_model is not None
        self.assertEqual(
            user_setting_model.user_bio,
            user.user_bio,
            """user_bio is not same as expected"""
        )