From c5631eb489528d514732e4b94d8720bd1c2747da Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Thu, 20 Jun 2013 10:24:40 -0400 Subject: [PATCH] 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) --- zephyr/tests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/zephyr/tests.py b/zephyr/tests.py index 998e97765d..3ae8fe6bad 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -2274,8 +2274,11 @@ xxxxxxx

\n

xxxxxxx xxxxx xxxx xxxxx:
\nxxxxxx: xxx (':even faker smile:', ':even faker smile:'), ] - # Check every single emoji - for img in bugdown.emoji_list: + # Check a random sample of our 800+ emojis to make + # 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 test_cases.append((emoji_text, emoji_img(emoji_text)))