Steve Jorgensen wrote:
> Oops. Obviously, the above is pseudo-code because I left ('~OTHER~',
> 'Something
> else') the first assert, and I have (Food, Food) instead of
> (Food,) * 4 for the second assert. Possibly some other mistakes as well.
Umm, like the fact that I'm testing for colors instead of foods since I changed
the kind of example case. :)
Here's an updated example, minus the comments — still pseudocode with possible
mistakes:
from choices import ChoicesContext
# Get choices context for Food choices.
fcc = ChoicesContext()
class Food(fcc.base):
fcc.APPLE
fcc.GREEK_YOGURT
fcc.EGG_MCMUFFIN %= 'Egg McMuffin'
fcc.append('~OTHER~', 'Something else')
assert (
(Food.Apple, Food.GREEK_YOGURT, fcc.EGG_MCMUFFIN) ==
('APPLE', 'GREEK_YOGURT', 'EGG_MCMUFFIN'))
assert tuple(Food) == (
('APPLE', 'Apple'),
('GREEK_YOGURT', 'Greek Yogurt'),
('EGG_MCMIFFIN', 'Egg McMuffin'),
('~OTHER~', 'Something else'),
)
assert tuple(type(food) for food in Food) == (Food,) * 4
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/6CQNDKSO7LHL5RTUA7M76BYKN3AR7ILV/
Code of Conduct: http://python.org/psf/codeofconduct/