Improve dir( GithubObject )

This commit is contained in:
Vincent Jacques
2012-02-12 18:30:01 +01:00
parent 88ef264264
commit 9b3cd652e1
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -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:
+3
View File
@@ -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 )