def test_remove_unused_strings(self): strings = ('', 'hei', 'hoi') model = (1, StringIndex(0), 42, StringIndex(2), -1, None) model, strings = _KeywordRemover().remove_unused_strings( model, strings) assert_equals(strings, ('', 'hoi')) assert_equals(model, (1, 0, 42, 1, -1, None))
def test_remove_unused_strings_nested(self): strings = tuple(' abcde') model = (StringIndex(0), StringIndex(1), 2, 3, StringIndex(4), 5, (0, StringIndex(1), 2, StringIndex(3), 4, 5)) model, strings = _KeywordRemover().remove_unused_strings( model, strings) assert_equals(strings, tuple(' acd')) assert_equals(model, (0, 1, 2, 3, 3, 5, (0, 1, 2, 2, 4, 5)))
def test_through_jsexecutionresult(self): suite = (0, StringIndex(1), 2, 3, 4, StringIndex(5), ((0, 1, 2, StringIndex(3), 4, 5, (), (), ('suite', 'kws'), 9), ), ((0, 1, 2, StringIndex(3), 4, 5, ('test', 'kws')), (0, StringIndex(1), 2, 3, 4, 5, ('test', 'kws'))), ('suite', 'kws'), 9) exp_s = (0, 0, 2, 3, 4, 2, ((0, 1, 2, 1, 4, 5, (), (), (), 9), ), ((0, 1, 2, 1, 4, 5, ()), (0, 0, 2, 3, 4, 5, ())), (), 9) result = JsExecutionResult(suite=suite, strings=tuple(' ABCDEF'), errors=(1, 2), statistics={}, basemillis=0, min_level='DEBUG') assert_equals(result.data['errors'], (1, 2)) result.remove_data_not_needed_in_report() assert_equals(result.strings, tuple('ACE')) assert_equals(result.suite, exp_s) assert_equals(result.min_level, 'DEBUG') assert_true('errors' not in result.data)