use warnings better, small typo correction in test
This commit is contained in:
parent
4cf17c3993
commit
48b95f2700
4 changed files with 8 additions and 7 deletions
|
|
@ -2,6 +2,7 @@ import datetime as dt
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import warnings
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
@ -287,7 +288,7 @@ def openQCD_filter(results:pd.DataFrame, **kwargs: Any) -> pd.DataFrame:
|
||||||
The filtered results.
|
The filtered results.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
raise Warning("A filter for openQCD parameters is no implemented yet.")
|
warnings.warn("A filter for openQCD parameters is no implemented yet.", Warning, 1)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import warnings
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
@ -80,7 +81,7 @@ def save(path: Path, message: str, files: list[Path] | None=None) -> None:
|
||||||
files = [path / f for f in files]
|
files = [path / f for f in files]
|
||||||
dl.save(files, message=message, dataset=path)
|
dl.save(files, message=message, dataset=path)
|
||||||
elif tracker == 'None':
|
elif tracker == 'None':
|
||||||
raise Warning("Tracker 'None' does not implement save.")
|
warnings.warn("Tracker 'None' does not implement save.", Warning, 1)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Tracker {tracker} is not supported.")
|
raise ValueError(f"Tracker {tracker} is not supported.")
|
||||||
|
|
||||||
|
|
@ -122,7 +123,7 @@ def unlock(path: Path, file: Path) -> None:
|
||||||
if tracker == 'datalad':
|
if tracker == 'datalad':
|
||||||
dl.unlock(os.path.join(path, file), dataset=path)
|
dl.unlock(os.path.join(path, file), dataset=path)
|
||||||
elif tracker == 'None':
|
elif tracker == 'None':
|
||||||
raise Warning("Tracker 'None' does not implement unlock.")
|
warnings.warn("Tracker 'None' does not implement unlock.", Warning, 1)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Tracker {tracker} is not supported.")
|
raise ValueError(f"Tracker {tracker} is not supported.")
|
||||||
return
|
return
|
||||||
|
|
@ -169,7 +170,7 @@ def drop(path: Path, reckless: str | None=None) -> None:
|
||||||
if tracker == 'datalad':
|
if tracker == 'datalad':
|
||||||
dl.drop(path, reckless=reckless)
|
dl.drop(path, reckless=reckless)
|
||||||
elif tracker == 'None':
|
elif tracker == 'None':
|
||||||
raise Warning("Tracker 'None' does not implement drop.")
|
warnings.warn("Tracker 'None' does not implement drop.", Warning, 1)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Tracker {tracker} is not supported.")
|
raise ValueError(f"Tracker {tracker} is not supported.")
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -306,8 +306,7 @@ def test_openQCD_filter() -> None:
|
||||||
"updated_at"]
|
"updated_at"]
|
||||||
df = pd.DataFrame(data,columns=cols)
|
df = pd.DataFrame(data,columns=cols)
|
||||||
|
|
||||||
with pytest.warns(Warning):
|
find.openQCD_filter(df, a = "asdf")
|
||||||
find.openQCD_filter(df, a = "asdf")
|
|
||||||
|
|
||||||
|
|
||||||
def test_code_filter() -> None:
|
def test_code_filter() -> None:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ def test_toml_check_measurement_data() -> None:
|
||||||
"param_file": "/path/to/file",
|
"param_file": "/path/to/file",
|
||||||
"version": "1.1",
|
"version": "1.1",
|
||||||
"prefix": "pref",
|
"prefix": "pref",
|
||||||
"cfg_seperator": "n",
|
"cfg_separator": "n",
|
||||||
"names": ['list', 'of', 'names']
|
"names": ['list', 'of', 'names']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue