def test_sync_before(self): manager = FakeCellStateManager() def test(inst, *args, **kwargs): self.assertEqual(inst, manager) self.assertEqual(args, (1, 2, 3)) self.assertEqual(kwargs, dict(a=4, b=5, c=6)) return 'result' wrapper = state.sync_before(test) result = wrapper(manager, 1, 2, 3, a=4, b=5, c=6) self.assertEqual(result, 'result') self.assertEqual(manager.called, [('_cell_data_sync', False)])
def test_sync_before(self): manager = FakeCellStateManager() def test(inst, *args, **kwargs): self.assertEqual(manager, inst) self.assertEqual((1, 2, 3), args) self.assertEqual(dict(a=4, b=5, c=6), kwargs) return 'result' wrapper = state.sync_before(test) result = wrapper(manager, 1, 2, 3, a=4, b=5, c=6) self.assertEqual('result', result) self.assertEqual([('_cell_data_sync', False)], manager.called)