Created
June 3, 2014 08:45
-
-
Save krig/e9f2ed7848ad1bbf1cc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options_wait = True | |
def test_should_wait(): | |
def f1(options_wait, rv, command_wait, level_should_wait, in_transit, interactive): | |
return options_wait and rv and (command_wait or (level_should_wait and (in_transit or not interactive))) | |
def f2(options_wait, rv, command_wait, level_should_wait, in_transit, interactive): | |
if not options_wait: | |
return False | |
if command_wait: | |
return True | |
by_level = level_should_wait | |
transit_or_noninteractive = in_transit or not interactive | |
return by_level and transit_or_noninteractive | |
for options_wait in (True, False): | |
for command_wait in (True, False): | |
for level_should_wait in (True, False): | |
for in_transit in (True, False): | |
for interactive in (True, False): | |
if not f1(options_wait, True, command_wait, level_should_wait, in_transit, interactive) == \ | |
f2(options_wait, True, command_wait, level_should_wait, in_transit, interactive): | |
print "error!", options_wait, command_wait, level_should_wait, in_transit, interactive | |
test_should_wait() | |
# => no output | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment