コード例 #1
0
def test_singleton2():
    """Testing singleton property"""
    conf = dj.Config()
    conf['dummy.val'] = 2
    _ = dj.Config()  # a new instance should not delete dummy.val
    assert_true(conf['dummy.val'] == 2,
                'Config does not behave like a singleton.')
コード例 #2
0
def test_load_save():
    """Testing load and save"""
    dj.config.save('tmp.json')
    conf = dj.Config()
    conf.load('tmp.json')
    assert_true(conf == dj.config, 'Two config files do not match.')
    os.remove('tmp.json')
コード例 #3
0
def test_singleton():
    """Testing singleton property"""
    dj.config.save('tmp.json')
    conf = dj.Config()
    conf.load('tmp.json')
    conf['dummy.val'] = 2

    assert_true(conf == dj.config, 'Config does not behave like a singleton.')
    os.remove('tmp.json')