- Timestamp:
- 09/04/10 00:07:14 (21 months ago)
- Location:
- trunk
- Files:
-
- 1 removed
- 2 modified
- 10 copied
-
examples/parameters/validation (copied) (copied from branches/parameter_set_schema_validation/examples/parameters/validation)
-
examples/parameters/validation/data (copied) (copied from branches/parameter_set_schema_validation/examples/parameters/validation/data)
-
examples/parameters/validation/data/conf1.yaml (copied) (copied from branches/parameter_set_schema_validation/examples/parameters/validation/data/conf1.yaml)
-
examples/parameters/validation/data/conf2.yaml (copied) (copied from branches/parameter_set_schema_validation/examples/parameters/validation/data/conf2.yaml)
-
examples/parameters/validation/data/conf_schema1.yaml (copied) (copied from branches/parameter_set_schema_validation/examples/parameters/validation/data/conf_schema1.yaml)
-
examples/parameters/validation/simple_validation.py (copied) (copied from branches/parameter_set_schema_validation/examples/parameters/validation/simple_validation.py)
-
setup.py (modified) (1 diff)
-
src/parameters (copied) (copied from branches/parameter_set_schema_validation/src/parameters)
-
src/parameters.py (deleted)
-
src/parameters/__init__.py (copied) (copied from branches/parameter_set_schema_validation/src/parameters/__init__.py)
-
src/parameters/validators.py (copied) (copied from branches/parameter_set_schema_validation/src/parameters/validators.py)
-
test/test_parameters.py (modified) (2 diffs)
-
test/test_validators.py (copied) (copied from branches/parameter_set_schema_validation/test/test_validators.py)
Legend:
- Unmodified
- Added
- Removed
-
trunk/setup.py
r451 r465 14 14 'NeuroTools.spike2.sonpy', 15 15 'NeuroTools.datastore', 16 'NeuroTools.parameters', 16 17 'NeuroTools.datastore.django_orm', 17 18 'NeuroTools.optimize', -
trunk/test/test_parameters.py
r355 r465 86 86 ps2 = ParameterSet({'a': 1, 'b':2}) 87 87 self.assertEqual(ps1, ps2) 88 89 def test_create_from_flat_iterator(self): 90 ps = ParameterSet({'a':1, 'b':2}, label="PS1") 91 ps2 = ParameterSet({'ps':ps, 'c':19}, label="PS2") 92 ps3 = ParameterSet({'hello': 'world', 'ps2': ps2, 'null': None, 93 'true': False, 'mylist': [1,2,3,4], 94 'mydict': {'c': 3, 'd':4}, 'yourlist': [1,2,{'e':5, 'f':6}], 95 }, label="PS3") 96 ps4 = ParameterSet({}) 97 for x in ps3.flat(): 98 ps4.flat_add(x[0],x[1]) 99 self.assertEqual(ps4, ps3) 100 88 101 89 102 def test_create_with_syntax_error(self): … … 95 108 def test_create_with_invalid_initialiser(self): 96 109 self.assertRaises(TypeError, ParameterSet, object) 110 111 def test_create_yaml_url(self): 112 import tempfile, yaml 113 114 conf1_str = """ 115 # user info 116 username: joe 117 email: joe@example.com 118 119 # recipes 120 recipes: 121 all: /somewhere1/file1.xml 122 specific: /somewhere2/file2.xml 123 """ 124 125 ps = ParameterSet 126 127 tf = tempfile.NamedTemporaryFile(suffix='.yaml') 128 tf.file.writelines(conf1_str) 129 130 tf.file.flush() 131 tf.file.seek(0) 132 133 ps = ParameterSet("file://"+tf.name) 134 135 tf.close() 136 137 ps1 = ParameterSet(yaml.load(conf1_str)) 138 assert ps1 == ps 139 140 141 142 97 143 98 144 class ParameterSetSaveLoadTest(unittest.TestCase):
