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 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 of type '*.jpg' from http://google.com." ])
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 testDescribeRLCombinationWithSingularTime(self): url = "http://google.com" options = [ Option('-l', '--level', '1'), Option('-r', '--recursive', None), ] exps = optcombo_explain(url, options) self.assertEqual(exps, [ "Recursively scrape web pages from http://google.com, following links 1 time." ])
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 of type '*.jpg' from http://google.com, " + "following links 4 times." ])