@@ -24,31 +24,31 @@ def test_raise_exception_if_daterange_is_not_provided():
24
24
store = TopLevelTickStore (Mock ())
25
25
with pytest .raises (Exception ) as e :
26
26
store ._get_library_metadata (None )
27
- assert "A date range must be provided" in str (e )
27
+ assert "A date range must be provided" in str (e . value )
28
28
29
29
30
30
def test_raise_exception_if_date_range_does_not_contain_start_date ():
31
31
store = TopLevelTickStore (Mock ())
32
32
dr = DateRange (start = None , end = dt (2011 , 1 , 1 ))
33
33
with pytest .raises (Exception ) as e :
34
34
store ._get_library_metadata (dr )
35
- assert "The date range {0} must contain a start and end date" .format (dr ) in str (e )
35
+ assert "The date range {0} must contain a start and end date" .format (dr ) in str (e . value )
36
36
37
37
38
38
def test_raise_exception_if_date_range_does_not_contain_end_date ():
39
39
store = TopLevelTickStore (Mock ())
40
40
dr = DateRange (start = dt (2011 , 1 , 1 ), end = None )
41
41
with pytest .raises (Exception ) as e :
42
42
store ._get_library_metadata (dr )
43
- assert "The date range {0} must contain a start and end date" .format (dr ) in str (e )
43
+ assert "The date range {0} must contain a start and end date" .format (dr ) in str (e . value )
44
44
45
45
46
46
def test_raise_exception_if_date_range_does_not_contain_start_and_end_date ():
47
47
store = TopLevelTickStore (Mock ())
48
48
dr = DateRange (start = None , end = None )
49
49
with pytest .raises (Exception ) as e :
50
50
store ._get_library_metadata (dr )
51
- assert "The date range {0} must contain a start and end date" .format (dr ) in str (e )
51
+ assert "The date range {0} must contain a start and end date" .format (dr ) in str (e . value )
52
52
53
53
54
54
def test_raise_exception_and_log_an_error_if_an_invalid_library_name_is_added ():
@@ -66,7 +66,7 @@ def test_raise_exception_if_date_range_overlaps():
66
66
self ._get_library_metadata .return_value = [TickStoreLibrary ('lib1' , None ), ]
67
67
with pytest .raises (OverlappingDataException ) as e :
68
68
TopLevelTickStore .add (self , DateRange (start = dt (2010 , 1 , 1 ), end = dt (2011 , 1 , 1 , 23 , 59 , 59 , 999000 )), "blah" )
69
- assert "There are libraries that overlap with the date range:" in str (e )
69
+ assert "There are libraries that overlap with the date range:" in str (e . value )
70
70
71
71
72
72
@pytest .mark .parametrize (('start' , 'end' , 'expected_start' , 'expected_end' ),
@@ -103,7 +103,7 @@ def test_raise_error_add_library_is_called_with_a_date_range_not_on_day_boundari
103
103
self = create_autospec (TopLevelTickStore , _arctic_lib = MagicMock (), _collection = MagicMock ())
104
104
self ._get_library_metadata .return_value = []
105
105
TopLevelTickStore .add (self , DateRange (start = start , end = end ), "blah" )
106
- assert "Date range should fall on UTC day boundaries" in str (e )
106
+ assert "Date range should fall on UTC day boundaries" in str (e . value )
107
107
108
108
109
109
@pytest .mark .parametrize (('start' , 'end' , 'expected_start_index' , 'expected_end_index' ),
@@ -179,4 +179,4 @@ def test_slice_raises():
179
179
m = TopLevelTickStore (Mock ())
180
180
with pytest .raises (UnhandledDtypeException ) as e :
181
181
m ._slice ("abc" , 1 , 2 )
182
- assert ("Can't persist type" in str (e ))
182
+ assert ("Can't persist type" in str (e . value ))
0 commit comments