Skip to content

Corrected test#3155

Merged
hugovk merged 1 commit into
python-pillow:masterfrom
radarhere:legacy_api_test
Jun 6, 2018
Merged

Corrected test#3155
hugovk merged 1 commit into
python-pillow:masterfrom
radarhere:legacy_api_test

Conversation

@radarhere

Copy link
Copy Markdown
Member

Instead of raising the Exception at https://github.com/python-pillow/Pillow/blob/master/src/PIL/TiffImagePlugin.py#L484 as intended, this test was raising a NameError because ImageFileDirectory_v2 is not imported.

@radarhere
radarhere force-pushed the legacy_api_test branch 2 times, most recently from f7ac555 to 3f3b56f Compare June 5, 2018 10:58
@hugovk

hugovk commented Jun 5, 2018

Copy link
Copy Markdown
Member

Good spot, asserting against Exception is a bit too general.

Should we also assert the exception message to be sure it's the right one?

    def test_set_legacy_api(self):
        ifd = TiffImagePlugin.ImageFileDirectory_v2()
        with self.assertRaises(Exception) as e:
            ifd.legacy_api = None
        self.assertEqual(str(e.exception),
                         "Not allowing setting of legacy api")

@radarhere

Copy link
Copy Markdown
Member Author

Okay, sure, I've updated the commit with your code.

@hugovk

hugovk commented Jun 6, 2018

Copy link
Copy Markdown
Member

The AppVeyor failure is unrelated, I've created #3156 for that.

@hugovk
hugovk merged commit 02f99c5 into python-pillow:master Jun 6, 2018
@radarhere
radarhere deleted the legacy_api_test branch June 6, 2018 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants