Beispiel #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")
Beispiel #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")
Beispiel #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!")
Beispiel #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!")