import os import sys # add package .zip to python lookup path __dir__ = os.path.dirname(__file__) path = os.path.join(__dir__, 'funniest') sys.path.insert(0, path) import funniest print funniest.joke() print "I am not funny" import argparse parser = argparse.ArgumentParser() parser.add_argument("echo", help="echo the string you use here") args = parser.parse_args() print args.echo
def test_joke(self): got_joke = joke() self.assertTrue(isinstance(got_joke, basestring))
def test_is_nonempty(self): s = funniest.joke() self.assertTrue(len(s) > 0)
def test_is_string(self): s = funniest.joke() self.assertTrue(isinstance(s, str))
def do_GET(self): print self.path self.wfile.write('HTTP/1.1 200 Okay\r\n\r\n' + funniest.joke())
import funniest print(funniest.joke()) import pkgutil greeting = pkgutil.get_data("funniest", 'data/greeting.txt') print(greeting)
def do_GET(self): print self.path self.wfile.write('HTTP/1.1 200 Okay\r\n\r\n'+funniest.joke())
def main(): if len(sys.argv) == 1: funniest.joke() else: output = ' '.join(sys.argv[1:]) print output
def main(): print funniest.joke()
def spout_wisdom(): print "There's a heaven for a G." print joke()
def do_GET(self): print(self.path) self.wfile.write(('HTTP/1.1 200 Okay\r\n\r\n'+funniest.joke()).encode(encoding='utf_8'))
def test_b(): import funniest assert funniest.joke( ) == "ek haathi tha, ek chiti thi" + "ek din chiti ne kaha" + "haahaa"