Esempio n. 1
0
    def test_string_format_default(self):
        """
        You need to format string according to given dictionary
        with support of default value if key is not exists
        """
        string = "Player 1 is - {player1}. Player 2 is {player2}"
        params = {"player1": 'Alice'}
        default_value = "Default Player"

        result = strings.string_format(string, params, default_value)
        self.assertEqual(result, "Player 1 is - Alice. Player 2 is Default Player")
Esempio n. 2
0
    def test_string_format_default(self):
        """
        You need to format string according to given dictionary
        with support of default value if key is not exists
        """
        string = "Player 1 is - {player1}. Player 2 is {player2}"
        params = {"player1": 'Alice'}
        default_value = "Default Player"

        result = strings.string_format(string, params, default_value)
        self.assertEqual(result,
                         "Player 1 is - Alice. Player 2 is Default Player")
Esempio n. 3
0
 def test_string_format(self):
     """
     You need to format string according to given dictionary
     """
     result = strings.string_format("Hello {user}!", {"user": '******'})
     self.assertEqual(result, "Hello Vitaly!")
Esempio n. 4
0
 def test_string_format(self):
     """
     You need to format string according to given dictionary
     """
     result = strings.string_format("Hello {user}!", {"user": '******'})
     self.assertEqual(result, "Hello Vitaly!")