Esempio n. 1
0
    def test_load_unknown_path_type(self, tmp_path):
        "Test loading an unknown ``path[type]``."

        with pytest.raises(ValueError) as e:
            load_data_files('image/png', tmp_path, {'type': 'nonsense'})

        assert str(e.value) == 'Unknown type of path "nonsense".'
Esempio n. 2
0
    def test_load_wrong_format_type(self, tmp_path):
        "Test loading a non-existing format."

        with pytest.raises(TypeError) as e:
            load_data_files(0x348f, tmp_path)

        assert str(
            e.value
        ) == 'Parameter "fmt" must be a string or a dict, but it is of type "<class \'int\'>".'
Esempio n. 3
0
    def test_load_non_existing_format(self, tmp_path):
        "Test loading a non-existing format."

        with pytest.raises(RuntimeError) as e:
            load_data_files('nonsense', tmp_path)

        assert str(
            e.value
        ) == 'The format loader map does not specify a loader for format "nonsense".'
Esempio n. 4
0
    def test_load_unknown_type_of_path(self, tmp_path):
        "Test loading an unknown type of the parameter ``path``."

        with pytest.raises(TypeError) as e:
            load_data_files('audio/wav', tmp_path, 12)

        assert str(
            e.value
        ) == f'Unsupported type of the "path" parameter: {type(12)}.'