mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Improve dir( GithubObject )
This commit is contained in:
@@ -38,6 +38,8 @@ class GithubObjectWithOnlySimpleScalarAttributes( TestCaseWithGithubTestObject )
|
||||
SimpleScalarAttributes( "a1", "a2", "a3", "a4" )
|
||||
)
|
||||
|
||||
def testInterface( self ):
|
||||
self.assertEqual( [ e for e in dir( self.o ) if not e.startswith( "_" ) ], [ "a1", "a2", "a3", "a4" ] )
|
||||
|
||||
def testCompletion( self ):
|
||||
# A GithubObject:
|
||||
|
||||
@@ -135,6 +135,9 @@ def GithubObject( className, *attributePolicies ):
|
||||
else:
|
||||
self.__attributes[ attributeName ] = attributeDefinition.getValueFromRawValue( self, attributeValue )
|
||||
|
||||
def __dir__( self ):
|
||||
return attributeDefinitions.keys()
|
||||
|
||||
def __fetchAttribute( self, attributeName ):
|
||||
attributeDefinition = attributeDefinitions[ attributeName ]
|
||||
attributeDefinition.updateAttributes( self )
|
||||
|
||||
Reference in New Issue
Block a user