Automated testing: Difference between revisions

From OpenHatch wiki
Content added Content deleted
(Gustavo)
imported>Blues chick
(Replaced content with "{{Hacking OpenHatch}} This page is now included in our project package, and is automatically generated by sphinx at openhatch.readthedocs.org: [http://openhatch.readthedo...")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Hacking OpenHatch}}
Better solution:class Product(object): def __init__(self, purcodt_id): self.id = purcodt_iddef make_property(prop): def getter(self): return api_obj.get_product_property(self.id, prop) return property(getter)for prop in ('price', 'attr'): setattr(Product, prop, make_property(prop))Reasons this is better: * You don’t break dir(product): it still shows the properties. * You get the AttributeError for free.If you want to support an arbitrary number of properties, it probably makes more sense to have a .get_property(prop) method, or to use .__getitem__ instead.

This page is now included in our project package, and is automatically generated by sphinx at openhatch.readthedocs.org: [http://openhatch.readthedocs.org/en/latest/advanced/advanced_testing.html Advanced Testing]

Latest revision as of 15:30, 22 August 2014

This is a page about improving or modifying OpenHatch.

We call that "Hacking OpenHatch," and there is a whole category of pages about that.


This page is now included in our project package, and is automatically generated by sphinx at openhatch.readthedocs.org: Advanced Testing