コード例 #1
0
ファイル: test_euler.py プロジェクト: jeffreywinn/jabbapylib
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
コード例 #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
コード例 #3
0
ファイル: hacker_titles.py プロジェクト: the7day/jabbapylib
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')
コード例 #4
0
ファイル: hacker.py プロジェクト: ThePenguin1140/jabbapylib
def get_random_title():
    """Returns a random hacker title."""
    d = fs.read_json(INPUT)
    li = d['for_business_cards']
    return choice(li)
コード例 #5
0
ファイル: test_fs.py プロジェクト: ThePenguin1140/jabbapylib
 def test_read_json(self):
     d = fs.read_json(JSON)
     assert d['name'] == 'Jabba Laci'
コード例 #6
0
def get_random_title():
    """Returns a random hacker title."""
    d = fs.read_json(INPUT)
    li = d['for_business_cards']
    return choice(li)
コード例 #7
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')
コード例 #8
0
ファイル: test_fs.py プロジェクト: the7day/jabbapylib
 def test_read_json(self):
     d = fs.read_json(JSON)
     assert d['name'] == 'Jabba Laci'