예제 #1
0
 def test_msgs(self):
     msgs = ["a", "b", "c"]
     try:
         managercli.systemExit(1, msgs)
     except SystemExit:
         pass
     self.assertEquals("%s\n" % ("\n".join(msgs)), sys.stderr.buffer)
예제 #2
0
 def test_msg_unicode(self):
     msgs = [u"\u2620 \u2603 \u203D"]
     try:
         managercli.systemExit(1, msgs)
     except SystemExit:
         pass
     self.assertEquals("%s\n" % msgs[0].encode("utf8"), sys.stderr.buffer)
예제 #3
0
 def test_msg_and_exception(self):
     msgs = ["a", ValueError()]
     try:
         managercli.systemExit(1, msgs)
     except SystemExit:
         pass
     self.assertEquals("%s\n\n" % msgs[0], sys.stderr.buffer)
예제 #4
0
 def test_msg_unicode(self):
     msgs = [u"\u2620 \u2603 \u203D"]
     try:
         managercli.systemExit(1, msgs)
     except SystemExit:
         pass
     self.assertEquals("%s\n" % msgs[0].encode("utf8"), sys.stderr.buffer)
예제 #5
0
 def test_a_msg(self):
     msg = "some message"
     try:
         managercli.systemExit(1, msg)
     except SystemExit:
         pass
     self.assertEquals("%s\n" % msg, sys.stderr.buffer)
예제 #6
0
 def test_msg_and_exception(self):
     msgs = ["a", ValueError()]
     try:
         managercli.systemExit(1, msgs)
     except SystemExit:
         pass
     self.assertEquals("%s\n\n" % msgs[0], sys.stderr.buffer)
예제 #7
0
 def test_msgs(self):
     msgs = ["a", "b", "c"]
     try:
         managercli.systemExit(1, msgs)
     except SystemExit:
         pass
     self.assertEquals("%s\n" % ("\n".join(msgs)), sys.stderr.buffer)
예제 #8
0
 def test_a_msg(self):
     msg = "some message"
     try:
         managercli.systemExit(1, msg)
     except SystemExit:
         pass
     self.assertEquals("%s\n" % msg, sys.stderr.buffer)
예제 #9
0
 def test_systemExit(self):
     try:
         managercli.systemExit(
             1,
             _("'%s' is not a valid serial number") % "123123")
     except SystemExit:
         # tis okay, we are looking for unicode errors on the string encode
         pass
예제 #10
0
    def test_msg_and_exception_no_str(self):
        class NoStrException(Exception):
            pass

        msgs = ["a", NoStrException()]
        try:
            managercli.systemExit(1, msgs)
        except SystemExit:
            pass
        self.assertEquals("%s\n\n" % msgs[0], sys.stderr.buffer)
예제 #11
0
    def test_msg_and_exception_no_str(self):
        class NoStrException(Exception):
            pass

        msgs = ["a", NoStrException()]
        try:
            managercli.systemExit(1, msgs)
        except SystemExit:
            pass
        self.assertEquals("%s\n\n" % msgs[0], sys.stderr.buffer)
예제 #12
0
    def test_msg_and_exception_str(self):
        class StrException(Exception):
            def __init__(self, msg):
                self.msg = msg

            def __str__(self):
                return self.msg

        msg = "bar"
        msgs = ["a", StrException(msg)]
        try:
            managercli.systemExit(1, msgs)
        except SystemExit:
            pass
        self.assertEquals("%s\n%s\n" % ("a", msg), sys.stderr.buffer)
예제 #13
0
    def test_msg_and_exception_str(self):
        class StrException(Exception):
            def __init__(self, msg):
                self.msg = msg

            def __str__(self):
                return self.msg

        msg = "bar"
        msgs = ["a", StrException(msg)]
        try:
            managercli.systemExit(1, msgs)
        except SystemExit:
            pass
        self.assertEquals("%s\n%s\n" % ("a", msg), sys.stderr.buffer)
예제 #14
0
 def test_systemExit(self):
     try:
         managercli.systemExit(1, _("'%s' is not a valid serial number") % "123123")
     except SystemExit:
         # tis okay, we are looking for unicode errors on the string encode
         pass