Changeset 329 for pyyaml/trunk/tests3/test_constructor.py
- Timestamp:
- 12/29/08 13:11:08 (3 years ago)
- Files:
-
- 1 modified
-
pyyaml/trunk/tests3/test_constructor.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/tests3/test_constructor.py
r328 r329 7 7 8 8 def execute(code): 9 global value 9 10 exec(code) 10 11 return value … … 12 13 def _make_objects(): 13 14 global MyLoader, MyDumper, MyTestClass1, MyTestClass2, MyTestClass3, YAMLObject1, YAMLObject2, \ 14 AnObject, AnInstance, AState, ACustomState, InitArgs, InitArgsWithState, \ 15 NewArgs, NewArgsWithState, Reduce, ReduceWithState, MyInt, MyList, MyDict, \ 16 FixedOffset, execute 15 AnObject, AnInstance, AState, ACustomState, NewArgs, NewArgsWithState, \ 16 Reduce, ReduceWithState, MyInt, MyList, MyDict, FixedOffset, execute 17 17 18 18 class MyLoader(yaml.Loader): … … 100 100 return False 101 101 102 class AnObject (object):102 class AnObject: 103 103 def __new__(cls, foo=None, bar=None, baz=None): 104 104 self = object.__new__(cls) … … 143 143 def __setstate__(self, state): 144 144 self.foo, self.bar, self.baz = state 145 146 class InitArgs(AnInstance):147 def __getinitargs__(self):148 return (self.foo, self.bar, self.baz)149 def __getstate__(self):150 return {}151 152 class InitArgsWithState(AnInstance):153 def __getinitargs__(self):154 return (self.foo, self.bar)155 def __getstate__(self):156 return self.baz157 def __setstate__(self, state):158 self.baz = state159 145 160 146 class NewArgs(AnObject):
