def test_safe_format(): from reframe.utility.sanity import _format s = 'There is {0} and {1}.' assert s == _format(s) assert s == _format(s, 'bacon') assert 'There is egg and spam.' == _format(s, 'egg', 'spam') assert 'There is egg and bacon.' == _format(s, 'egg', 'bacon', 'spam') s = 'no placeholders' assert s == _format(s) assert s == _format(s, 'bacon')
def test_safe_format(self): from reframe.utility.sanity import _format s = 'There is {0} and {1}.' self.assertEqual(s, _format(s)) self.assertEqual(s, _format(s, 'bacon')) self.assertEqual('There is egg and spam.', _format(s, 'egg', 'spam')) self.assertEqual('There is egg and bacon.', _format(s, 'egg', 'bacon', 'spam')) s = 'no placeholders' self.assertEqual(s, _format(s)) self.assertEqual(s, _format(s, 'bacon'))