def test_duplicate_keywords():
    """
    Tests whether there are doublicate keywords in the yaml
    """
    initialize()
    yamlfile = """{
            "model": !obj:pylearn2.models.mlp.MLP {
            "layers": [
                     !obj:pylearn2.models.mlp.Sigmoid {
                         "layer_name": 'h0',
                         "dim": 20,
                         "sparse_init": 15,
                     }],
            "nvis": 784,
            "nvis": 384,
        }
    }"""

    try:
        load(yamlfile)
    except yaml.constructor.ConstructorError as e:
        message = str(e)
        assert message.endswith("found duplicate key (nvis)")
        pass
    except Exception as e:
        error_msg = "Got the unexpected error: %s" % (e)
        raise TypeError(error_msg)
dataset/ETHPy150Open lisa-lab/pylearn2/pylearn2/config/tests/test_yaml_parse.py/test_duplicate_keywords/original