def test_get_random_color(self): for i in xrange(100): self.assertIn(get_random_color(), _TANGO_PALETTE) used_colors = set() for i in xrange(len(_TANGO_PALETTE)): color = get_random_color(ignore=used_colors) self.assertNotIn(color, used_colors) self.assertIn(color, _TANGO_PALETTE) used_colors.add(color) # One last time, since all colors were used get_random_color(ignore=used_colors)
def create_model(self, store): used_colors = set([woc.color for woc in store.find(WorkOrderCategory)]) color = get_random_color(ignore=used_colors) return WorkOrderCategory( store=store, name=u'', color=color)
def create_model(self, store): used_colors = set([pc.color for pc in store.find(PaymentCategory)]) color = get_random_color(ignore=used_colors) return PaymentCategory(name=u'', color=color, category_type=int(self._category_type), store=store)
def create_model(self, store): used_colors = set([ pc.color for pc in store.find(PaymentCategory)]) color = get_random_color(ignore=used_colors) return PaymentCategory(name=u'', color=color, category_type=int(self._category_type), store=store)
def create_model(self, store): used_colors = set([woc.color for woc in store.find(WorkOrderCategory)]) color = get_random_color(ignore=used_colors) return WorkOrderCategory(store=store, name=u'', color=color)