OSCA-Kampala-Chapter / autobot

Autobot is a bot library targetted to build software bots for various platforms with ease of integration in mind
MIT License
14 stars 15 forks source link

Bug in test #90

Closed TobiasHT5 closed 2 years ago

TobiasHT5 commented 2 years ago

Currently, the test is designed to help track any new fields being added to telegram bot api as version 6.3 is progressing. A specific area of the test relies on the ability for an object to raise AttributeError when an attribute not explicitly listed in the __slots__ tuple of that has been assigned to it. The unfortunate bit is that any attributes that don't exist in the __slots__ are being successfully added to object with setattr and therefore are not triggering the AttributeError to record them. I have not figured out why the AttributeError is not being triggered as yet, but I'm making a quick fix to the test

TobiasHT5 commented 2 years ago

This is not really a bug as I observed later, but a consequence of all objects being subclasses of the BaseObject class. This means even though the indivdual subclasses have __slots__, the base class still as the __dict__ and items are being added to that dict. This is a sort of good thing because __slots__ imposes as a hard limit on the number of attributes to have in a given class, which would raise errors if the parser passed attributes to any object that doesn't expect them. This has triggered a thought in me of how to include a mechanism that gracefully adapts the codebase to new telegram API versions being released. I'll be working on this