Add add_column()
This commit is contained in:
parent
191d93e33f
commit
8cd3fdc131
|
@ -530,3 +530,11 @@ class RefineProject:
|
||||||
def star_row(self, row, starred=True):
|
def star_row(self, row, starred=True):
|
||||||
return self.annotate_one_row(row, 'starred', starred)
|
return self.annotate_one_row(row, 'starred', starred)
|
||||||
|
|
||||||
|
def add_column(self, column, new_column, expression='value',
|
||||||
|
column_insert_index=None, on_error='set-to-blank'):
|
||||||
|
if column_insert_index is None:
|
||||||
|
column_insert_index = self.column_index[column] + 1
|
||||||
|
response = self.do_json('add-column', {'baseColumnName': column,
|
||||||
|
'newColumnName': new_column, 'expression': expression,
|
||||||
|
'columnInsertIndex': column_insert_index, 'onError': on_error})
|
||||||
|
return response
|
||||||
|
|
|
@ -278,6 +278,11 @@ class TutorialTestDuplicateDetection(RefineTestCase):
|
||||||
response = self.project.get_rows(sort_by='email')
|
response = self.project.get_rows(sort_by='email')
|
||||||
indexes = [r.index for r in response.rows]
|
indexes = [r.index for r in response.rows]
|
||||||
self.assertEqual(indexes, range(10))
|
self.assertEqual(indexes, range(10))
|
||||||
|
# {10}
|
||||||
|
response = self.project.add_column('email', 'count',
|
||||||
|
'facetCount(value, "value", "email")')
|
||||||
|
self.assertTrue('column email by filling 10 rows' in
|
||||||
|
response['historyEntry']['description'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue