@@ -156,3 +156,95 @@ def test_to_pb(self):
156156 pb_val = row_filter .to_pb ()
157157 expected_pb = data_pb2 .RowFilter (value_regex_filter = regex )
158158 self .assertEqual (pb_val , expected_pb )
159+
160+
161+ class Test_CellCountFilter (unittest2 .TestCase ):
162+
163+ def _getTargetClass (self ):
164+ from gcloud .bigtable .row import _CellCountFilter
165+ return _CellCountFilter
166+
167+ def _makeOne (self , * args , ** kwargs ):
168+ return self ._getTargetClass ()(* args , ** kwargs )
169+
170+ def test_constructor (self ):
171+ num_cells = object ()
172+ row_filter = self ._makeOne (num_cells )
173+ self .assertTrue (row_filter .num_cells is num_cells )
174+
175+ def test___eq__type_differ (self ):
176+ num_cells = object ()
177+ row_filter1 = self ._makeOne (num_cells = num_cells )
178+ row_filter2 = object ()
179+ self .assertNotEqual (row_filter1 , row_filter2 )
180+
181+ def test___eq__same_value (self ):
182+ num_cells = object ()
183+ row_filter1 = self ._makeOne (num_cells = num_cells )
184+ row_filter2 = self ._makeOne (num_cells = num_cells )
185+ self .assertEqual (row_filter1 , row_filter2 )
186+
187+ def test___ne__same_value (self ):
188+ num_cells = object ()
189+ row_filter1 = self ._makeOne (num_cells = num_cells )
190+ row_filter2 = self ._makeOne (num_cells = num_cells )
191+ comparison_val = (row_filter1 != row_filter2 )
192+ self .assertFalse (comparison_val )
193+
194+
195+ class TestCellsRowOffsetFilter (unittest2 .TestCase ):
196+
197+ def _getTargetClass (self ):
198+ from gcloud .bigtable .row import CellsRowOffsetFilter
199+ return CellsRowOffsetFilter
200+
201+ def _makeOne (self , * args , ** kwargs ):
202+ return self ._getTargetClass ()(* args , ** kwargs )
203+
204+ def test_to_pb (self ):
205+ from gcloud .bigtable ._generated import bigtable_data_pb2 as data_pb2
206+
207+ num_cells = 76
208+ row_filter = self ._makeOne (num_cells )
209+ pb_val = row_filter .to_pb ()
210+ expected_pb = data_pb2 .RowFilter (cells_per_row_offset_filter = num_cells )
211+ self .assertEqual (pb_val , expected_pb )
212+
213+
214+ class TestCellsRowLimitFilter (unittest2 .TestCase ):
215+
216+ def _getTargetClass (self ):
217+ from gcloud .bigtable .row import CellsRowLimitFilter
218+ return CellsRowLimitFilter
219+
220+ def _makeOne (self , * args , ** kwargs ):
221+ return self ._getTargetClass ()(* args , ** kwargs )
222+
223+ def test_to_pb (self ):
224+ from gcloud .bigtable ._generated import bigtable_data_pb2 as data_pb2
225+
226+ num_cells = 189
227+ row_filter = self ._makeOne (num_cells )
228+ pb_val = row_filter .to_pb ()
229+ expected_pb = data_pb2 .RowFilter (cells_per_row_limit_filter = num_cells )
230+ self .assertEqual (pb_val , expected_pb )
231+
232+
233+ class TestCellsColumnLimitFilter (unittest2 .TestCase ):
234+
235+ def _getTargetClass (self ):
236+ from gcloud .bigtable .row import CellsColumnLimitFilter
237+ return CellsColumnLimitFilter
238+
239+ def _makeOne (self , * args , ** kwargs ):
240+ return self ._getTargetClass ()(* args , ** kwargs )
241+
242+ def test_to_pb (self ):
243+ from gcloud .bigtable ._generated import bigtable_data_pb2 as data_pb2
244+
245+ num_cells = 10
246+ row_filter = self ._makeOne (num_cells )
247+ pb_val = row_filter .to_pb ()
248+ expected_pb = data_pb2 .RowFilter (
249+ cells_per_column_limit_filter = num_cells )
250+ self .assertEqual (pb_val , expected_pb )
0 commit comments