@@ -91,7 +91,13 @@ def test_repr(self):
91
91
92
92
class ScalarTimeSeriesTest (tb_test .TestCase ):
93
93
def _scalar_time_series (
94
- self , max_step , max_wall_time , plugin_content , description , display_name
94
+ self ,
95
+ max_step ,
96
+ max_wall_time ,
97
+ plugin_content ,
98
+ description ,
99
+ display_name ,
100
+ last_value ,
95
101
):
96
102
# Helper to use explicit kwargs.
97
103
return provider .ScalarTimeSeries (
@@ -100,6 +106,7 @@ def _scalar_time_series(
100
106
plugin_content = plugin_content ,
101
107
description = description ,
102
108
display_name = display_name ,
109
+ last_value = last_value ,
103
110
)
104
111
105
112
def test_repr (self ):
@@ -109,26 +116,28 @@ def test_repr(self):
109
116
plugin_content = b"AB\xCD \xEF !\x00 " ,
110
117
description = "test test" ,
111
118
display_name = "one two" ,
119
+ last_value = 0.0001 ,
112
120
)
113
121
repr_ = repr (x )
114
122
self .assertIn (repr (x .max_step ), repr_ )
115
123
self .assertIn (repr (x .max_wall_time ), repr_ )
116
124
self .assertIn (repr (x .plugin_content ), repr_ )
117
125
self .assertIn (repr (x .description ), repr_ )
118
126
self .assertIn (repr (x .display_name ), repr_ )
127
+ self .assertIn (repr (x .last_value ), repr_ )
119
128
120
129
def test_eq (self ):
121
- x1 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" )
122
- x2 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" )
123
- x3 = self ._scalar_time_series (66 , 4321.0 , b"\x7F " , "hmm" , "hum" )
130
+ x1 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" , 512 )
131
+ x2 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" , 512 )
132
+ x3 = self ._scalar_time_series (66 , 4321.0 , b"\x7F " , "hmm" , "hum" , 1024 )
124
133
self .assertEqual (x1 , x2 )
125
134
self .assertNotEqual (x1 , x3 )
126
135
self .assertNotEqual (x1 , object ())
127
136
128
137
def test_hash (self ):
129
- x1 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" )
130
- x2 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" )
131
- x3 = self ._scalar_time_series (66 , 4321.0 , b"\x7F " , "hmm" , "hum" )
138
+ x1 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" , 512 )
139
+ x2 = self ._scalar_time_series (77 , 1234.5 , b"\x12 " , "one" , "two" , 512 )
140
+ x3 = self ._scalar_time_series (66 , 4321.0 , b"\x7F " , "hmm" , "hum" , 1024 )
132
141
self .assertEqual (hash (x1 ), hash (x2 ))
133
142
# The next check is technically not required by the `__hash__`
134
143
# contract, but _should_ pass; failure on this assertion would at
0 commit comments