Exemplo n.º 1
0
def test_unihan_options(unihan_options, test_config_file):
    app = Cihai.from_file(test_config_file)
    bootstrap.bootstrap_unihan(app.metadata, unihan_options)
    assert 'Unihan' in app.metadata.tables
    assert app.metadata.tables['Unihan'].columns
    assert set(app.metadata.tables['Unihan'].columns.keys()) == \
        set(bootstrap.UNIHAN_FIELDS + ['ucn', 'char'])
    assert bootstrap.is_bootstrapped(app.metadata)
Exemplo n.º 2
0
def test_unihan_options(unihan_options, test_config_file):
    app = Cihai.from_file(test_config_file)
    bootstrap.bootstrap_unihan(app.sql.metadata, unihan_options)
    assert 'Unihan' in app.sql.metadata.tables
    assert app.sql.metadata.tables['Unihan'].columns
    assert set(app.sql.metadata.tables['Unihan'].columns.keys()) == set(
        bootstrap.UNIHAN_FIELDS + ['ucn', 'char']
    )
    assert bootstrap.is_bootstrapped(app.sql.metadata)
Exemplo n.º 3
0
def cli(ctx, config, log_level):
    """Retrieve CJK information via CLI.

    For help and example usage, see documentation:

    https://cihai-cli.git-pull.com and https://cihai.git-pull.com"""
    setup_logger(level=log_level.upper())
    if config:
        c = Cihai.from_file(config)
    else:
        c = Cihai()

    if not c.unihan.is_bootstrapped:
        click.echo("Bootstrapping Unihan database")
        c.unihan.bootstrap(options=c.config.get('unihan_options', {}))

    ctx.obj['c'] = c  # pass Cihai object down to other commands
Exemplo n.º 4
0
def test_yaml_config_and_override(test_config_file):
    app = Cihai.from_file(test_config_file)

    assert app.config['database']
Exemplo n.º 5
0
def test_yaml_config_and_override(test_config_file):
    app = Cihai.from_file(test_config_file)

    assert app.config['database']