def test_dc_process_consecspaces_multiple_locations(self): '''ensure we can replace consecutive spaces for processing 2 locations, one at end''' test_limit_1='%s'%(' '*1) test_limit_2='%s'%(' '*2) test_string = 'recording_7.wav %sWow that is %s awesome%s' % (test_limit_1,test_limit_2,test_limit_2) print('...test string >>%s' % test_string) tst_dc = DataClean(contents=test_string) status,updated_string = tst_dc._search_replace() print(updated_string) self.assertLess(len(updated_string), len(test_string), '...expected string to less due to replacements') self.assertTrue(status,'...expected to be under the limit, confirm')
def test_dc_process_consecspaces_beginning_both_single(self): '''ensure we can replace consecutive spaces for processing, none should return false''' test_limit_1='>>%s<<'%(' '*1) test_limit_2='>>%s<<'%(' '*1) test_string = 'recording_7.wav %sWow that is %s awesome' % (test_limit_1,test_limit_2) print('...test string >>%s' % test_string) tst_dc = DataClean(contents=test_string) status,updated_string = tst_dc._search_replace() print(updated_string) self.assertEqual(len(updated_string), len(test_string), '...expected string to equal since no replacement') self.assertFalse(status,'...nothing should have been replaced based on default regex')
def test_dc_process_consecspaces_beginning_one_single_and_double_single(self): '''ensure we can replace consecutive spaces for processing, second one should be replaced''' test_limit_1='>>%s<<'%(' '*1) test_limit_2='>>%s<<'%(' '*2) test_string = 'recording_7.wav %sWow that is %s awesome' % (test_limit_1,test_limit_2) print('...test string >>%s' % test_string) tst_dc = DataClean(contents=test_string) status,updated_string = tst_dc._search_replace() print(updated_string) self.assertLess(len(updated_string), len(test_string), '...expected string to less due to replacements') self.assertTrue(status,'...expected to be under the limit, confirm')
def test_dc_process_consecspaces_beginning_both_multiple(self): '''ensure we can replace consecutive spaces for processing, both need to be replaced''' test_limit_1='>>%s<<'%(' '*30) test_limit_2='>>%s<<'%(' '*25) test_string = 'recording_7.wav %sWow that is %s awesome' % (test_limit_1,test_limit_2) tst_dc = DataClean(contents=test_string) status,updated_string = tst_dc._search_replace() print('...replace status: %s' % status) print('...test string >>:%s' % test_string) print('...updated string >>:%s' % updated_string) self.assertLess(len(updated_string), len(test_string), '...expected string to less due to replacements') self.assertTrue(status,'...expected to be under the limit, confirm')