diff --git a/src/crowsetta/formats/bbox/raven.py b/src/crowsetta/formats/bbox/raven.py index 7e28fc93..346c367b 100644 --- a/src/crowsetta/formats/bbox/raven.py +++ b/src/crowsetta/formats/bbox/raven.py @@ -25,8 +25,8 @@ class RavenSchema(pandera.pandas.DataFrameModel): begin_time_s: Series[float] = pandera.pandas.Field() end_time_s: Series[float] = pandera.pandas.Field() - low_freq_hz: Series[float] = pandera.pandas.Field() - high_freq_hz: Series[float] = pandera.pandas.Field() + low_freq_hz: Series[float] = pandera.pandas.Field(coerce=True) + high_freq_hz: Series[float] = pandera.pandas.Field(coerce=True) annotation: Series[pd.StringDtype] = pandera.pandas.Field(coerce=True) class Config: diff --git a/tests/test_formats/test_bbox/test_audbbox.py b/tests/test_formats/test_bbox/test_audbbox.py index a9a2ef9e..33675dd8 100644 --- a/tests/test_formats/test_bbox/test_audbbox.py +++ b/tests/test_formats/test_bbox/test_audbbox.py @@ -53,7 +53,7 @@ def test_raven_schema_bad_df(self, an_audbbox_path): # if we just load the csv directly, it will be invalid df = pd.read_csv(an_audbbox_path, sep="\t", header=None) - with pytest.raises(pandera.errors.SchemaError): + with pytest.raises(pandera.errors.SchemaErrors): crowsetta.formats.bbox.audbbox.AudBBoxSchema.validate(df) diff --git a/tests/test_formats/test_seq/test_audseq.py b/tests/test_formats/test_seq/test_audseq.py index d0d23dab..1ee5dafe 100644 --- a/tests/test_formats/test_seq/test_audseq.py +++ b/tests/test_formats/test_seq/test_audseq.py @@ -22,7 +22,7 @@ def test_audseq_schema_bad_df(self, an_audseq_path): audseq_df = pd.read_csv(an_audseq_path, sep="\t", header=None) # notice: wrong column name 'stop_time' audseq_df.columns = ["start_time", "stop_time", "label"] - with pytest.raises(pandera.errors.SchemaError): + with pytest.raises(pandera.errors.SchemaErrors): crowsetta.formats.seq.audseq.AudSeqSchema.validate(audseq_df) diff --git a/tests/test_formats/test_seq/test_generic.py b/tests/test_formats/test_seq/test_generic.py index d1fc70db..2b29641f 100644 --- a/tests/test_formats/test_seq/test_generic.py +++ b/tests/test_formats/test_seq/test_generic.py @@ -62,7 +62,7 @@ def test_missing_column_raises(self, csv_missing_fields_in_header): def test_invalid_column_raises(self, csv_with_invalid_fields_in_header): """test that invalid column name 'invalid' raises a schema error""" invalid_df = pd.read_csv(csv_with_invalid_fields_in_header) - with pytest.raises(pandera.errors.SchemaError): + with pytest.raises(pandera.errors.SchemaErrors): crowsetta.formats.seq.generic.GenericSeqSchema.validate(invalid_df) def test_onset_s_with_no_offset_s_raises(self, csv_with_onset_s_but_no_offset_s): @@ -378,7 +378,7 @@ def test_csv2annot_missing_fields_raises(self, csv_missing_fields_in_header): crowsetta.formats.seq.generic.csv2annot(csv_path=csv_missing_fields_in_header) def test_csv2annot_invalid_fields_raises(self, csv_with_invalid_fields_in_header): - with pytest.raises(pandera.errors.SchemaError): + with pytest.raises(pandera.errors.SchemaErrors): crowsetta.formats.seq.generic.csv2annot(csv_path=csv_with_invalid_fields_in_header) diff --git a/tests/test_formats/test_seq/test_simple.py b/tests/test_formats/test_seq/test_simple.py index 2533b8a2..6c5ddc25 100644 --- a/tests/test_formats/test_seq/test_simple.py +++ b/tests/test_formats/test_seq/test_simple.py @@ -22,7 +22,7 @@ def test_simple_seq_schema_bad_df(self, a_simple_csv_path): simple_df = pd.read_csv(a_simple_csv_path) # notice: wrong column names simple_df.columns = ["text", "begin_sample", "end_sample"] - with pytest.raises(pandera.errors.SchemaError): + with pytest.raises(pandera.errors.SchemaErrors): simple_df = crowsetta.formats.seq.simple.SimpleSeqSchema.validate(simple_df) diff --git a/tests/test_formats/test_seq/test_timit.py b/tests/test_formats/test_seq/test_timit.py index bcc833be..cc8602f8 100644 --- a/tests/test_formats/test_seq/test_timit.py +++ b/tests/test_formats/test_seq/test_timit.py @@ -19,7 +19,7 @@ def test_timit_schema_bad_df(self, a_transcript_path): phn_df = pd.read_csv(a_transcript_path, sep=" ", header=None) # notice: wrong column names phn_df.columns = ["text", "begin_sample", "end_sample"] - with pytest.raises(pandera.errors.SchemaError): + with pytest.raises(pandera.errors.SchemaErrors): phn_df = crowsetta.formats.seq.timit.TimitTranscriptSchema.validate(phn_df)