- Timestamp:
- 12/29/08 13:11:08 (3 years ago)
- Location:
- pyyaml/trunk
- Files:
-
- 2 added
- 14 modified
-
lib3/yaml/constructor.py (modified) (1 diff)
-
lib3/yaml/emitter.py (modified) (1 diff)
-
tests3/data/construct-python-bytes.code (added)
-
tests3/data/construct-python-bytes.data (added)
-
tests3/data/construct-python-long-short.code (modified) (1 diff)
-
tests3/data/construct-python-name-module.code (modified) (1 diff)
-
tests3/data/construct-python-name-module.data (modified) (1 diff)
-
tests3/data/construct-python-object.code (modified) (1 diff)
-
tests3/data/construct-python-object.data (modified) (1 diff)
-
tests3/data/construct-python-str-utf8.code (modified) (1 diff)
-
tests3/data/construct-python-unicode-ascii.code (modified) (1 diff)
-
tests3/data/construct-python-unicode-utf8.code (modified) (1 diff)
-
tests3/data/construct-str-utf8.code (modified) (1 diff)
-
tests3/data/recursive-set.recursive (modified) (1 diff)
-
tests3/test_constructor.py (modified) (4 diffs)
-
tests3/test_recursive.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/lib3/yaml/constructor.py
r328 r329 510 510 module_name, object_name = name.rsplit('.', 1) 511 511 else: 512 module_name = ' __builtin__'512 module_name = 'builtins' 513 513 object_name = name 514 514 try: -
pyyaml/trunk/lib3/yaml/emitter.py
r328 r329 181 181 self.tag_prefixes = self.DEFAULT_TAG_PREFIXES.copy() 182 182 if self.event.tags: 183 handles = self.event.tags.keys() 184 handles.sort() 183 handles = sorted(self.event.tags.keys()) 185 184 for handle in handles: 186 185 prefix = self.event.tags[handle] -
pyyaml/trunk/tests3/data/construct-python-long-short.code
r144 r329 1 123 L1 123 -
pyyaml/trunk/tests3/data/construct-python-name-module.code
r322 r329 1 [ file, yaml.Loader, yaml.dump, abs, yaml.tokens]1 [str, yaml.Loader, yaml.dump, abs, yaml.tokens] -
pyyaml/trunk/tests3/data/construct-python-name-module.data
r146 r329 1 - !!python/name: file1 - !!python/name:str 2 2 - !!python/name:yaml.Loader 3 3 - !!python/name:yaml.dump -
pyyaml/trunk/tests3/data/construct-python-object.code
r147 r329 8 8 AState(1, 'two', [3,3,3]), 9 9 ACustomState(1, 'two', [3,3,3]), 10 11 InitArgs(1, 'two', [3,3,3]),12 InitArgsWithState(1, 'two', [3,3,3]),13 10 14 11 NewArgs(1, 'two', [3,3,3]), -
pyyaml/trunk/tests3/data/construct-python-object.data
r147 r329 7 7 - !!python/object:test_constructor.AState { _foo: 1, _bar: two, _baz: [3,3,3] } 8 8 - !!python/object/new:test_constructor.ACustomState { state: !!python/tuple [1, two, [3,3,3]] } 9 10 - !!python/object/new:test_constructor.InitArgs [1, two, [3,3,3]]11 - !!python/object/new:test_constructor.InitArgsWithState { args: [1, two], state: [3,3,3] }12 9 13 10 - !!python/object/new:test_constructor.NewArgs [1, two, [3,3,3]] -
pyyaml/trunk/tests3/data/construct-python-str-utf8.code
r144 r329 1 u'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430'.encode('utf-8') 1 '\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' -
pyyaml/trunk/tests3/data/construct-python-unicode-ascii.code
r144 r329 1 u"ascii string"1 "ascii string" -
pyyaml/trunk/tests3/data/construct-python-unicode-utf8.code
r144 r329 1 u'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430'1 '\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' -
pyyaml/trunk/tests3/data/construct-str-utf8.code
r144 r329 1 u'\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430'1 '\u042d\u0442\u043e \u0443\u043d\u0438\u043a\u043e\u0434\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430' -
pyyaml/trunk/tests3/data/recursive-set.recursive
r228 r329 1 try:2 set3 except NameError:4 from sets import Set as set5 1 value = set() 6 2 value.add(AnInstance(foo=value, bar=value)) -
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): -
pyyaml/trunk/tests3/test_recursive.py
r328 r329 24 24 25 25 def test_recursive(recursive_filename, verbose=False): 26 exec(open(recursive_filename, 'rb').read()) 27 value1 = value 26 context = globals().copy() 27 exec(open(recursive_filename, 'rb').read(), context) 28 value1 = context['value'] 28 29 output1 = None 29 30 value2 = None
