Esempio n. 1
0
    def test_misc_string_split_exception(self):
        """
        UTILS | Test that the readable string splitter throws the right \
exception
        """

        misc.string_split_readable("word", 3)
Esempio n. 2
0
    def test_misc_string_split_exception(self):
        """
        UTILS | Test that the readable string splitter throws the right \
exception
        """

        misc.string_split_readable("word", 3)
Esempio n. 3
0
    def test_misc_string_split_readable(self):
        """
        UTILS | Test readable string splitter
        """

        chunks = list(misc.string_split_readable("xxxxxx", 6))
        nosetools.eq_(chunks, ["xxxxxx"], "One chunk")

        chunks = list(misc.string_split_readable("xxx xxx", 3))
        nosetools.eq_(chunks, ["xxx", "xxx"], "Two chunks")

        chunks = list(misc.string_split_readable("xx xx xx", 2))
        nosetools.eq_(chunks, ["xx", "xx", "xx"], "Three chunks")

        chunks = list(misc.string_split_readable("x x x x x x", 1))
        nosetools.eq_(chunks, ["x", "x", "x", "x", "x", "x"], "Six chunks")
Esempio n. 4
0
    def test_misc_string_split_readable(self):
        """
        UTILS | Test readable string splitter
        """

        chunks = list(misc.string_split_readable("xxxxxx", 6))
        nosetools.eq_(chunks, ["xxxxxx"], "One chunk")

        chunks = list(misc.string_split_readable("xxx xxx", 3))
        nosetools.eq_(chunks, ["xxx", "xxx"], "Two chunks")

        chunks = list(misc.string_split_readable("xx xx xx", 2))
        nosetools.eq_(chunks, ["xx", "xx", "xx"], "Three chunks")

        chunks = list(misc.string_split_readable("x x x x x x", 1))
        nosetools.eq_(chunks, ["x", "x", "x", "x", "x", "x"], "Six chunks")
Esempio n. 5
0
def _list(args, packages):
    print ""
    print "+%s+%s+%s+" % ("-" * 17, "-" * 7, "-" * 82)
    print "| %s | %s | %s |" \
          % (_("Name").ljust(15), _("Version").ljust(10),
             _("Description").ljust(75))
    print "+%s+%s+%s+" % ("-" * 17, "-" * 12, "-" * 77)
    for x in packages.packages:
        package = packages.data[x]
        version = package["version"]
        desc = package["description"]

        chunks = string_split_readable(desc, 75)
        i = False
        for chunk in chunks:
            if not i:
                print "| %s | %s | %s |" % (x.ljust(15), version.ljust(10),
                                            chunk.ljust(75))
                i = True
            else:
                print "| %s | %s | %s |" % ("".ljust(15), "".ljust(10),
                                            chunk.ljust(75))

        if package["requires"]["modules"]:
            needed = _("Needed modules: %s") \
                     % (", ".join(package["requires"]["modules"]))
            chunks = string_split_readable(needed, 78)
            for chunk in chunks:
                print "| %s | %s | > %s |" % ("".ljust(15), "".ljust(10),
                                              chunk.ljust(73))

        if package["requires"]["packages"]:
            needed = _("Needed packages: %s") \
                     % (", ".join(package["requires"]["packages"]))
            chunks = string_split_readable(needed, 78)
            for chunk in chunks:
                print "| %s | %s | > %s |" % ("".ljust(15), "".ljust(10),
                                              chunk.ljust(73))
    print "+%s+%s+%s+" % ("-" * 17, "-" * 7, "-" * 82)
Esempio n. 6
0
def _list(args, packages):
    print ""
    print "+%s+%s+%s+" % ("-" * 17, "-" * 7, "-" * 82)
    print "| %s | %s | %s |" \
          % (_("Name").ljust(15), _("Version").ljust(10),
             _("Description").ljust(75))
    print "+%s+%s+%s+" % ("-" * 17, "-" * 12, "-" * 77)
    for x in packages.packages:
        package = packages.data[x]
        version = package["version"]
        desc = package["description"]

        chunks = string_split_readable(desc, 75)
        i = False
        for chunk in chunks:
            if not i:
                print "| %s | %s | %s |" % (x.ljust(15), version.ljust(10),
                                            chunk.ljust(75))
                i = True
            else:
                print "| %s | %s | %s |" % ("".ljust(15), "".ljust(10),
                                            chunk.ljust(75))

        if package["requires"]["modules"]:
            needed = _("Needed modules: %s") \
                     % (", ".join(package["requires"]["modules"]))
            chunks = string_split_readable(needed, 78)
            for chunk in chunks:
                print "| %s | %s | > %s |" % ("".ljust(15), "".ljust(10),
                                              chunk.ljust(73))

        if package["requires"]["packages"]:
            needed = _("Needed packages: %s") \
                     % (", ".join(package["requires"]["packages"]))
            chunks = string_split_readable(needed, 78)
            for chunk in chunks:
                print "| %s | %s | > %s |" % ("".ljust(15), "".ljust(10),
                                              chunk.ljust(73))
    print "+%s+%s+%s+" % ("-" * 17, "-" * 7, "-" * 82)