Answer the question
In order to leave comments, you need to log in
How to test text on a mask?
I have code:
def test_html_return(self):
print('>> Admin:GravatarHelpersTest Тест на возвращаемый HTML')
html = '<img class="gravatar" src="https://secure.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028.jpg?d=mm&r=g&s=50" width="50"/>'
self.assertEqual(helpers.gravatar('[email protected]', 50), html)
Answer the question
In order to leave comments, you need to log in
Well, the simplest is to split the strings multiple times. First by "spaces", then by "quotes", then by "question". And now you have d=mm&r=g&s=50 in your hands. And you already split it by "&" and then by "=" with entering it into the dictionary. Everything. You have a dictionary with key-value pairs, the order is not important - you can check the presence and value of any key. Delov something on a few lines. It is better to issue a separate function or method. Well, or an exercise for lovers of lambda and one-liners :-)
You can also parse regular expressions again to the state of a dictionary.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question