コード例 #1
0
 def testSpellingLong(self):
     """--spelling should check spelling"""
     google.main(["--spelling", self.phrase])
     commandLineAnswer = self.lastOutput()
     google._output(google.doSpellingSuggestion(self.phrase),
                    self.spellingparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #2
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testMetaLong(self):
     """--meta should return meta information"""
     google.main(["--meta", "-s", self.q])
     commandLineAnswer = self.lastOutput()
     commandLineAnswer = commandLineAnswer[:commandLineAnswer.index('searchTime')]
     google._output(google.doGoogleSearch(self.q), self.metaparams)
     realAnswer = self.lastOutput()
     realAnswer = realAnswer[:realAnswer.index('searchTime')]
     self.assertEqual(commandLineAnswer, realAnswer)
コード例 #3
0
 def testMetaLong(self):
     """--meta should return meta information"""
     google.main(["--meta", "-s", self.q])
     commandLineAnswer = self.lastOutput()
     commandLineAnswer = commandLineAnswer[:commandLineAnswer.
                                           index('searchTime')]
     google._output(google.doGoogleSearch(self.q), self.metaparams)
     realAnswer = self.lastOutput()
     realAnswer = realAnswer[:realAnswer.index('searchTime')]
     self.assertEqual(commandLineAnswer, realAnswer)
コード例 #4
0
 def testLuckyLong(self):
     """--lucky should return only first result"""
     google.main(["--lucky", "-s", self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.luckyparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #5
0
 def testCacheLong(self):
     """--cache should retrieve cache"""
     google.main(["--cache", self.url])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGetCachedPage(self.url), self.cacheparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #6
0
 def testNoOptions(self):
     """no options at all should print usage"""
     google.main([])
     commandLineAnswer = self.lastOutput()
     google._usage()
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #7
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testSpellingLong(self):
     """--spelling should check spelling"""
     google.main(["--spelling", self.phrase])
     commandLineAnswer = self.lastOutput()
     google._output(google.doSpellingSuggestion(self.phrase), self.spellingparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #8
0
 def testSearchLong(self):
     """--search should search"""
     google.main(["--search", self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.searchparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #9
0
 def testVersionLong(self):
     """--version should print version"""
     google.main(["--version"])
     commandLineAnswer = self.lastOutput()
     google._version()
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #10
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testSearchDefault(self):
     """no options + search phrase should search"""
     google.main([self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.searchparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #11
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testSearchLong(self):
     """--search should search"""
     google.main(["--search", self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.searchparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #12
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testHelpLong(self):
     """--help should print usage"""
     google.main(["--help"])
     commandLineAnswer = self.lastOutput()
     google._usage()
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #13
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testVersionLong(self):
     """--version should print version"""
     google.main(["--version"])
     commandLineAnswer = self.lastOutput()
     google._version()
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #14
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testReverseLong(self):
     """--reverse should reverse results"""
     google.main(["--reverse", "-s", self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.reverseparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #15
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testLuckyLong(self):
     """--lucky should return only first result"""
     google.main(["--lucky", "-s", self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.luckyparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #16
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testNoOptions(self):
     """no options at all should print usage"""
     google.main([])
     commandLineAnswer = self.lastOutput()
     google._usage()
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #17
0
 def testReverseLong(self):
     """--reverse should reverse results"""
     google.main(["--reverse", "-s", self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.reverseparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #18
0
ファイル: app.py プロジェクト: picotera/yolo-bear
try:
    virtenv = os.path.join(os.environ.get('OPENSHIFT_PYTHON_DIR', '.'),
                           'virtenv')
    python_version = "python" + str(sys.version_info[0]) + "." + str(
        sys.version_info[1])
    os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib',
                                                  python_version,
                                                  'site-packages')
    virtualenv = os.path.join(virtenv, 'bin', 'activate_this.py')
    if (sys.version_info[0] < 3):
        execfile(virtualenv, dict(__file__=virtualenv))
    else:
        exec(open(virtualenv).read(), dict(__file__=virtualenv))

except IOError:
    pass

#
# IMPORTANT: Put any additional includes below this line.  If placed above this
# line, it's possible required libraries won't be in your searchable path
#

import google

#
#  main():
#
if __name__ == '__main__':
    google.main()
コード例 #19
0
 def testHelpLong(self):
     """--help should print usage"""
     google.main(["--help"])
     commandLineAnswer = self.lastOutput()
     google._usage()
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #20
0
def googl_srch():
    import google as goos
    goos.main()
    # return redirect('result.html')
    return redirect('/result')
コード例 #21
0
 def testSearchDefault(self):
     """no options + search phrase should search"""
     google.main([self.q])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGoogleSearch(self.q), self.searchparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())
コード例 #22
0
ファイル: googletest.py プロジェクト: eox03y/OldWorks
 def testCacheLong(self):
     """--cache should retrieve cache"""
     google.main(["--cache", self.url])
     commandLineAnswer = self.lastOutput()
     google._output(google.doGetCachedPage(self.url), self.cacheparams)
     self.assertEqual(commandLineAnswer, self.lastOutput())