class LCM2_MONITOR_STAND(base.Product): pid = 29 family = Family.LCM2 vendor = VendorRegistry.choose(1) class cap(base.Capability): def items(s): yield "one", "blah" yield "two", "other"
class LCM2_MONITOR_STAND(base.Product): pid = 29 family = Family.LCM2 vendor = VendorRegistry.choose(5) cap = default_capability_kls
vendor = VendorRegistry.choose(5) cap = default_capability_kls return ProductRegistry @pytest.fixture() def holder(self, ProductRegistry, default_capability_kls): return base.ProductsHolder(ProductRegistry, default_capability_kls) it "holds onto the products and creates by_pair", ProductRegistry, holder, default_capability_kls: assert holder.products is ProductRegistry assert holder.default_capability_kls is default_capability_kls assert holder.by_pair == { (VendorRegistry.LIFX, 1): ProductRegistry.LCM1_BOUNCY_BALL, (VendorRegistry.LIFX, 3): ProductRegistry.LCM2_DESK, (VendorRegistry.choose(5), 29): ProductRegistry.LCM2_MONITOR_STAND, } it "can yield product names", holder, ProductRegistry: assert sorted(holder.names) == sorted( ["LCM1_BOUNCY_BALL", "LCM2_DESK", "LCM2_MONITOR_STAND"] ) it "can access products by name", holder, ProductRegistry: assert holder.LCM1_BOUNCY_BALL is ProductRegistry.LCM1_BOUNCY_BALL assert holder.LCM2_DESK is ProductRegistry.LCM2_DESK it "complains if the product doesn't exist", holder: with assertRaises(AttributeError, "'ProductsHolder' object has no attribute 'LCM9_SPHERE'"): holder.LCM9_SPHERE
class P4(base.Product): pid = 1 family = Family.LCM2 vendor = VendorRegistry.choose(5) cap = capability
class LCM2_MONITOR_STAND(base.Product): pid = 29 family = Family.LCM2 vendor = VendorRegistry.choose(5) cap = capability friendly = "Monitor Stand"