SHARE
TWEET

happy_bumber_tests

a guest Mar 11th, 2014 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def return_happy(xrange):
  2.         return [x for x in xrange if is_happy(x)][0:]
  3.  
  4. def test_happy():
  5.         test_result=True
  6.         test_vals=[1, 7, 10, 13, 19, 23, 28, 31, 32, 44,
  7.          49, 68, 70, 79, 82, 86, 91, 94, 97, 100, 103,
  8.          109, 129, 130, 133, 139, 167, 176, 188, 190,
  9.          192, 193, 203, 208, 219, 226, 230, 236, 239,
  10.          262, 263, 280, 291, 293, 301, 302, 310, 313,
  11.          319, 320, 326, 329, 331, 338, 356, 362, 365,
  12.          367, 368, 376, 379, 383, 386, 391, 392, 397,
  13.          404, 409, 440, 446, 464, 469, 478, 487, 490,
  14.          496, 536, 556, 563, 565, 566, 608, 617, 622,
  15.          623, 632, 635, 637, 638, 644, 649, 653, 655,
  16.          656, 665, 671, 673, 680, 683, 694, 700, 709,
  17.          716, 736, 739, 748, 761, 763, 784, 790, 793,
  18.          802, 806, 818, 820, 833, 836, 847, 860, 863,
  19.          874, 881, 888, 899, 901, 904, 907, 910, 912, 913,
  20.          921, 923, 931, 932, 937, 940, 946, 964, 970, 973,
  21.          989, 998]
  22.          
  23.         result_vars=return_happy(range(1,1000))
  24.        
  25.         if len(test_vals)==len(result_vars):
  26.                 pass
  27.         else:
  28.                 test_result=False
  29.  
  30.  
  31.         for x in test_vals:
  32.                 if x in result_vars:
  33.                         pass
  34.                 else:
  35.                         test_result=False
  36.         return test_result
  37.  
  38. print (test_happy())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top