Can it be beneficial to put ourselves in situations where we know we will have to practice sitting with an urge?

For example, if cookies or potato chips or wine are things we would like to have control over and choose if and when we have them, can knowingly putting ourselves around those things be a good opportunity to practice or is that just plain dangerous!