Yes, but we wouldn't recommend it. Like the Samsung Galaxy S7 Edge, made famous by Lil Wayne's champagne commercial, the iPhone 7 and iPhone 7 Plus come with an IP67 rating for both dust and water protection. This theoretically means you can safely submerge your phone in liquid or get it wet without damaging it, but according to Apples fine print, liquid damage is not covered under warranty.
The splash, water, and dust resistance are also "not permanent conditions and resistance might decrease as a result of normal wear," according to Apple's website, and you should never attempt to charge a wet iPhone
This means even though the iPhone 7 and iPhone 7 Plus are both water resistant, you shouldn't really shower your device with champagne or dunk it in your beer.