Пример #1
0
    def testGeneralOptions(self):
        o = options.T()
        o.parse(["-P", "foo", "-f", "bar/baz.frm#wibble"])

        self.assertEqual(["foo", "bar"], o.extra_paths)
        self.assertEqual("baz.frm", o.basename)
        self.assertEqual("wibble", o.func)
Пример #2
0
    def testAllOptionsHaveHelp(self):
        o = options.T()
        help = o.help()

        names = ["--" + x.rstrip("=") for x in options.T.longparams]
        for name in names:
            self.assertNotEqual(0, help.count(name), "%s has no help" % name)
Пример #3
0
    def testDefaults(self):
        o = options.T()

        for x in [
                o.basename, o.func, o.innername, o.innerfunc, o.outername,
                o.outerfunc, o.map
        ]:
            self.assertEqual(None, x)

        for flag in [
                o.trace, o.tracez, o.print_version, o.quit_now,
                o.quit_when_done, o.explore, o.nogui
        ]:
            self.assertEqual(False, flag)

        self.assertEqual(-1, o.maxiter)
        self.assertEqual({}, o.paramchanges)
        self.assertEqual("", o.output)
        self.assertEqual([], o.extra_paths)

        self.assertEqual(0, o.width)
        self.assertEqual(0, o.height)
Пример #4
0
 def testTransforms(self):
     o = options.T()
     o.parse(["--transforms", "a#b,x#y"])
     self.assertEqual([("a", "b"), ("x", "y")], o.transforms)
Пример #5
0
    def testArgument(self):
        o = options.T()
        o.parse(["--params", "foo"])

        self.assertEqual(["foo"], o.args)
Пример #6
0
    def testHeightWidth(self):
        o = options.T()
        o.parse(["-i", "780", "-j", "445"])

        self.assertEqual(780, o.width)
        self.assertEqual(445, o.height)
Пример #7
0
 def testBadSplit(self):
     o = options.T()
     self.assertRaises(options.OptionError, o.parse, ["-f", "bar"])
Пример #8
0
 def testHelp(self):
     o = options.T()
     o.parse(["-h"])
     self.assertEqual(1, o.output.count("To generate an image"))
     self.assertEqual(True, o.quit_now)
Пример #9
0
 def testBadOption(self):
     o = options.T()
     self.assertRaises(options.OptionError, o.parse, ["--fish"])