def testNoExplanationIfNoCombos(self): url = "http://google.com" # Random grouping of non-existent arguments options = [ Option('', '--tweedledee', None), Option('', '--tweedledum', None), ] exps = optcombo_explain(url, options) self.assertEqual(exps, [])
def testDescribeRLCombination(self): url = "http://google.com" options = [ Option('-l', '--level', '4'), Option('-r', '--recursive', None), ] exps = optcombo_explain(url, options) self.assertEqual(exps, [ "Recursively scrape web pages linked from http://google.com, recursing 4 times." ])
def testDescribeRACombination(self): url = "http://google.com" options = [ Option('-A', '--accept', '*.jpg'), Option('-r', '--recursive', None), ] exps = optcombo_explain(url, options) self.assertEqual(exps, [ "Recursively scrape web pages linked from http://google.com of type '*.jpg'." ])
def testDescribeUserPwCombination(self): url = "http://google.com" options = [ Option('', '--user', 'me'), Option('', '--password', 'pw'), ] exps = optcombo_explain(url, options) self.assertEqual(exps, [ "Authenticate at http://google.com with username 'me' and password 'pw'." ])
def testDescribeRALCombination(self): # Note that this should *not* also generate a description for RA or RL, to avoid redundancy url = "http://google.com" options = [ Option('-l', '--level', '4'), Option('-A', '--accept', '*.jpg'), Option('-r', '--recursive', None), ] exps = optcombo_explain(url, options) self.assertEqual(exps, [ "Recursively scrape web pages linked from http://google.com of type '*.jpg', following links 4 times." ])