From 800e3caabcd9c85b0b2ae9299217ea31d0309545 Mon Sep 17 00:00:00 2001 From: Antoine van Gelder Date: Sun, 28 Oct 2007 09:45:28 +0000 Subject: Initial import --- (limited to 'unit/test_persistence.py') diff --git a/unit/test_persistence.py b/unit/test_persistence.py new file mode 100755 index 0000000..2062240 --- /dev/null +++ b/unit/test_persistence.py @@ -0,0 +1,48 @@ +#!/usr/bin/python +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +import sys +sys.path.append('..') + +from persistence.jokemachinestate import JokeMachineState + +def dump(obj, indent = ' '): + print indent + str(obj) + for name, prop in obj.__properties__: + value = prop.fget(obj) + print indent + name, '=', value #, ' "' + prop.__doc__ + '"' + if value.__class__ is list: + for item in value: + dump(item, indent + ' ') + + print indent + 'is_dirty =', obj.__dirty__ + + + + +state = JokeMachineState().test_data() + +print state.jokebooks +print state.next_jokebook_id + +#[max(joke.id) for joke in self.__jokes] + +#pickle = state.dumps() +#new_state = JokeMachineState.loads(pickle) +#dump(new_state) + + -- cgit v0.9.1