Add mass_edit() and edit()
This commit is contained in:
parent
a03212ca94
commit
1371911c94
|
@ -402,4 +402,16 @@ class RefineProject:
|
|||
'engine': self.engine.as_json(), 'columnName': column,
|
||||
'expression': expression, 'onError': on_error, 'repeat': repeat,
|
||||
'repeatCount': repeat_count})
|
||||
return response
|
||||
return response
|
||||
|
||||
def edit(self, column, edit_from, edit_to):
|
||||
edits = [{'from': [edit_from], 'to': edit_to}]
|
||||
return self.mass_edit(column, edits)
|
||||
|
||||
def mass_edit(self, column, edits, expression='value'):
|
||||
"""edits is [{'from': ['foo'], 'to': 'bar'}, {...}]"""
|
||||
edits = json.dumps(edits)
|
||||
response = self.do_json('mass-edit', {
|
||||
'engine': self.engine.as_json(), 'columnName': column,
|
||||
'expression': expression, 'edits': edits})
|
||||
return response
|
||||
|
|
|
@ -208,9 +208,13 @@ class TutorialTestTransformAndClustering(RefineTestCase):
|
|||
self.assertEqual(len(response.facets[0].choices), 76)
|
||||
response = self.project.text_transform(column='Office Title',
|
||||
expression='value.trim()')
|
||||
self.assertTrue('6895' in response['historyEntry']['description'])
|
||||
self.assertTrue('6895' in response['historyEntry']['description'])
|
||||
response = self.project.compute_facets()
|
||||
self.assertEqual(len(response.facets[0].choices), 67)
|
||||
# {5}
|
||||
response = self.project.edit(column='Office Title',
|
||||
'Councilmen', 'Councilman')
|
||||
self.assertTrue('13' in response['historyEntry']['description'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in New Issue