Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/unit/test_persistence.py
diff options
context:
space:
mode:
authorAntoine van Gelder <antoine@g7.org.za>2007-10-28 09:45:28 (GMT)
committer Antoine van Gelder <antoine@g7.org.za>2007-10-28 09:45:28 (GMT)
commit800e3caabcd9c85b0b2ae9299217ea31d0309545 (patch)
tree130af075b9cbc72eba462c58166c771739ded092 /unit/test_persistence.py
parent49eb6ebd4760b4bfcf009f7e887a3ef9a547061d (diff)
Initial import
Diffstat (limited to 'unit/test_persistence.py')
-rwxr-xr-xunit/test_persistence.py48
1 files changed, 48 insertions, 0 deletions
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)
+
+