Skip to content

Instantly share code, notes, and snippets.

@krig
Created June 3, 2014 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krig/e9f2ed7848ad1bbf1cc1 to your computer and use it in GitHub Desktop.
Save krig/e9f2ed7848ad1bbf1cc1 to your computer and use it in GitHub Desktop.
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