forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_errors.py
More file actions
26 lines (17 loc) · 788 Bytes
/
test_errors.py
File metadata and controls
26 lines (17 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import re
import assertpy
import feast.errors as errors
def test_error_error_detail():
e = errors.FeatureViewNotFoundException("abc")
d = e.to_error_detail()
assertpy.assert_that(d).is_not_none()
assertpy.assert_that(d).contains('"module": "feast.errors"')
assertpy.assert_that(d).contains('"class": "FeatureViewNotFoundException"')
assertpy.assert_that(re.search(r"abc", d)).is_true()
converted_e = errors.FeastError.from_error_detail(d)
assertpy.assert_that(converted_e).is_not_none()
assertpy.assert_that(str(converted_e)).is_equal_to(str(e))
assertpy.assert_that(repr(converted_e)).is_equal_to(repr(e))
def test_invalid_error_error_detail():
e = errors.FeastError.from_error_detail("invalid")
assertpy.assert_that(e).is_none()