Skip to content

Conversation

@aaronchall
Copy link
Contributor

@aaronchall aaronchall commented Jun 5, 2017

@mention-bot
Copy link

@aaronchall, thanks for your PR! By analyzing the history of the files in this pull request, we identified @zestyping, @ethanfurman and @birkenfeld to be potential reviewers.

class TestIsDataDescriptor(unittest.TestCase):

def test_custom_descriptors(self):
class NonDataDescriptor(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you specify the object class for the parent ? it is not required https://docs.python.org/3/reference/compound_stmts.html#class-definitions

Copy link
Contributor Author

@aaronchall aaronchall Jun 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be backported to 2, it is ostensibly fixing an incorrect implementation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the Python 3 code clear. Add the object class in a backport to Python 2.

@aaronchall
Copy link
Contributor Author

As it currently stands I am perfectly happy with this revision, but I am more than willing to consider change requests.

class TestIsDataDescriptor(unittest.TestCase):

def test_custom_descriptors(self):
class NonDataDescriptor(object):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the Python 3 code clear. Add the object class in a backport to Python 2.


def test_functions(self):
class Test(object):
def instance_method(self): ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pass for empty body.

a_lambda = lambda: ''
self.assertFalse(inspect.isdatadescriptor(type(Test().instance_method)),
'a instance method is not a data descriptor')
self.assertFalse(inspect.isdatadescriptor(classmethod),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why you test classmethod? Note that the type of class method is not classmethod.

'a instance method is not a data descriptor')
self.assertFalse(inspect.isdatadescriptor(classmethod),
'a class method is not a data descriptor')
self.assertFalse(inspect.isdatadescriptor(staticmethod),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

attrs = [a[0] for a in inspect.getmembers(C)]
self.assertNotIn('missing', attrs)

class TestIsDataDescriptor(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are not ran. Add the test class in run_unittest() list below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

def __delete__(self, name): ""
class DataDescriptor2(object):
__set__ = None
self.assertFalse(inspect.isdatadescriptor(NonDataDescriptor),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns False because NonDataDescriptor is a class.

__set__ = None
self.assertFalse(inspect.isdatadescriptor(NonDataDescriptor),
'class with only __get__ not a data descriptor')
self.assertTrue(inspect.isdatadescriptor(DataDescriptor0),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test would fail if TestIsDataDescriptor run.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I didn't expect the Spanish Inquisition!. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@aaronchall
Copy link
Contributor Author

I thought it was, "I didn't expect a kind of Spanish Inquisition!" not, I didn't expect the Spanish Inquisition!
(Nevertheless, I appreciate rigor in modifications to the best language of all time!)
Also, I have no idea how to resolve bedevere/news or appveyor's issues...

@bedevere-bot
Copy link

Nobody expects the Spanish Inquisition!

@serhiy-storchaka: please review the changes made to this pull request.

@aaronchall
Copy link
Contributor Author

@serhiy-storchaka Do you want an entry in the Misc/NEWS.d directory? If I do that, should I remove the entry in Misc/NEWS?

@serhiy-storchaka
Copy link
Member

Misc/NEWS no longer edited directly. You should add new entries into the Misc/NEWS.d directory as individual files. See https://docs.python.org/devguide/committing.html#what-s-new-and-news-entries.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @aaronchall! LGTM. But since this is related to delicate matters, it would be nice if yet one core dev will take a look.

@benjaminp
Copy link
Contributor

In general, this seems fine. My one nit is that rather than "and/or", let's just say "or". "and/or" is jargony.

@aaronchall
Copy link
Contributor Author

@benjaminp done, however, the "appveyor" build failed - not sure why, appears to be irrelevant.

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.

7 participants