Example #1
0
def test_gen_primes():
    """See if it generates correctly the primes below 1000."""
    etalon = fs.read_json(cfg.TEST_ASSETS_DIR + '/primes_below_1000.json')
    #
    li = []
    primes = euler.gen_primes()
    for p in primes:
        if p > 1000:
            break
        li.append(p)
    #
    assert li == etalon
Example #2
0
def test_gen_primes():
    """See if it generates correctly the primes below 1000."""
    etalon = fs.read_json(cfg.TEST_ASSETS_DIR + '/primes_below_1000.json')
    #
    li = []
    primes = euler.gen_primes()
    for p in primes:
        if p > 1000:
            break
        li.append(p)
    #
    assert li == etalon
Example #3
0
def main():
    d = fs.read_json(INPUT)
    print_titles(d['for_business_cards'], 'Hacker Titles for Business Cards')
    print
    print_titles(d['not_really_for_business_cards'],
                 'And some more, not so suited for business cards')
Example #4
0
def get_random_title():
    """Returns a random hacker title."""
    d = fs.read_json(INPUT)
    li = d['for_business_cards']
    return choice(li)
Example #5
0
 def test_read_json(self):
     d = fs.read_json(JSON)
     assert d['name'] == 'Jabba Laci'
Example #6
0
def get_random_title():
    """Returns a random hacker title."""
    d = fs.read_json(INPUT)
    li = d['for_business_cards']
    return choice(li)
def main():
    d = fs.read_json(INPUT)
    print_titles(d['for_business_cards'], 'Hacker Titles for Business Cards')
    print
    print_titles(d['not_really_for_business_cards'], 'And some more, not so suited for business cards')
Example #8
0
 def test_read_json(self):
     d = fs.read_json(JSON)
     assert d['name'] == 'Jabba Laci'