You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/units/TestUtilsStringFunctions.py

34 lines
843 B
Python

# -*- coding: utf-8 -*-
import unittest
import os
import os.path
import tempfile
import yaml
import passlib.hash
import string
import StringIO
import copy
from nose.plugins.skip import SkipTest
from ansible.utils import string_functions
import ansible.errors
import ansible.constants as C
import ansible.utils.template as template2
from ansible import __version__
import sys
reload(sys)
sys.setdefaultencoding("utf8")
class TestUtilsStringFunctions(unittest.TestCase):
def test_isprintable(self):
self.assertFalse(string_functions.isprintable(chr(7)))
self.assertTrue(string_functions.isprintable('hello'))
def test_count_newlines_from_end(self):
self.assertEqual(string_functions.count_newlines_from_end('foo\n\n\n\n'), 4)
self.assertEqual(string_functions.count_newlines_from_end('\nfoo'), 0)