def test_unicode_args_to_str(self): val_unicode = u'\u4500' expected_str = ("%s,k1=%s" % (val_unicode, val_unicode)).encode( 'utf-8', 'ignore') self.assertEqual(expected_str, args_to_str(val_unicode, k1=val_unicode))
def test_long_args_to_str(self): val = ''.join(['x' for _ in xrange(2000)]) shortened_val = val[:MAX_NUM_CHARS_LOGGED_PER_PARAM] + "..." self.assertEqual("1,a,True,None,k2=2,k1=%s" % shortened_val, args_to_str(1, 'a', True, None, k1=val, k2=2))
def test_args_to_str(self): self.assertEqual("", args_to_str()) self.assertEqual("1,a,True,None,k2=2,k1=v1", args_to_str(1, 'a', True, None, k1='v1', k2=2))
def test_unicode_args_to_str(self): val_unicode = u"\u4500" expected_str = ("%s,k1=%s" % (val_unicode, val_unicode)).encode("utf-8", "ignore") self.assertEqual(expected_str, args_to_str(val_unicode, k1=val_unicode))
def test_long_args_to_str(self): val = "".join(["x" for _ in xrange(2000)]) shortened_val = val[:MAX_NUM_CHARS_LOGGED_PER_PARAM] + "..." self.assertEqual("1,a,True,None,k2=2,k1=%s" % shortened_val, args_to_str(1, "a", True, None, k1=val, k2=2))
def test_args_to_str(self): self.assertEqual("", args_to_str()) self.assertEqual("1,a,True,None,k2=2,k1=v1", args_to_str(1, "a", True, None, k1="v1", k2=2))