Make test_emoji about 500ms faster.

The test_emoji test makes sure that we build the correct image
tag for all of our emojis.  It's the same underlying algorithm
for all 800+ images, so we now test it in O(1) times instead
of O(N) time.  Randomly sampling the emojis makes the tests
slightly non-determinisitic in a theoretical sense, but not in
a practical sense.

(imported from commit c78b50072953f2c081fca0272b9ecf762a4802db)
This commit is contained in:
Steve Howell
2013-06-20 10:24:40 -04:00
parent 07afbabb79
commit c5631eb489

View File

@@ -2274,8 +2274,11 @@ xxxxxxx</strong></p>\n<p>xxxxxxx xxxxx xxxx xxxxx:<br>\n<code>xxxxxx</code>: xxx
(':even faker smile:', ':even faker smile:'), (':even faker smile:', ':even faker smile:'),
] ]
# Check every single emoji # Check a random sample of our 800+ emojis to make
for img in bugdown.emoji_list: # sure that bugdown builds the correct image tag.
emojis = bugdown.emoji_list
emojis = random.sample(emojis, 15)
for img in emojis:
emoji_text = ":%s:" % img emoji_text = ":%s:" % img
test_cases.append((emoji_text, emoji_img(emoji_text))) test_cases.append((emoji_text, emoji_img(emoji_text)))