272539105f949ac28e37adac0474ac28d65256e0,tests/helpers/test_config_validation.py,,test_isfile,#,67

Before Change


    Validate that the value is an existing file.
    schema = vol.Schema(cv.isfile)

    with tempfile.NamedTemporaryFile() as fp:
        pass

    for value in ("invalid", None, -1, 0, 80000, fp.name):
        with pytest.raises(vol.Invalid):
            schema(value)

After Change


    schema = vol.Schema(cv.isfile)

    fake_file = "this-file-does-not.exist"
    assert not os.path.isfile(fake_file)

    for value in ("invalid", None, -1, 0, 80000, fake_file):
        with pytest.raises(vol.Invalid):
            schema(value)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: home-assistant/home-assistant
Commit Name: 272539105f949ac28e37adac0474ac28d65256e0
Time: 2016-10-17
Author: rob.capellini@gmail.com
File Name: tests/helpers/test_config_validation.py
Class Name:
Method Name: test_isfile


Project Name: facebookresearch/pythia
Commit Name: bd1822d9a84e157c468e78dafc8a8db20aa4c62f
Time: 2020-10-15
Author: vedanuj@fb.com
File Name: tests/models/test_vilbert.py
Class Name: TestViLBertTorchscript
Method Name: test_load_save_pretrain_model


Project Name: facebookresearch/pythia
Commit Name: bd1822d9a84e157c468e78dafc8a8db20aa4c62f
Time: 2020-10-15
Author: vedanuj@fb.com
File Name: tests/models/test_vilbert.py
Class Name: TestViLBertTorchscript
Method Name: test_load_save_finetune_model