import simulacra as si if __name__ == "__main__": obj = si.Specification("John", foo="bar", baz="bo") print(obj.info()) print( si.utils.obj_to_filename( obj, [ # ('__class__', '__name__'), "name", "foo", ("baz", lambda x: x.upper()), ], ))
def test_base_simulation_cannot_be_instantiated_because_abstract(): with pytest.raises(TypeError): si.Specification("dummy").to_sim()
def test_spec_absorbs_extra_kwargs(): s = si.Specification("foobar", extra="joe", bing="baz") assert s._extra_attr_keys == {"extra", "bing"} assert s.extra == "joe" assert s.bing == "baz"
import simulacra as si if __name__ == '__main__': obj = si.Specification('John', foo='bar', baz='bo') print(obj.info()) print( si.utils.obj_to_filename( obj, [ # ('__class__', '__name__'), 'name', 'foo', ('baz', lambda x: x.upper()) ]))
def setUp(self): self.obj = si.Simulation(si.Specification('baz')) self.obj_name = 'baz' self.target_name = 'baz.sim' si.utils.ensure_parents_exist(TEST_DIR)
def setUp(self): self.obj = si.Specification('bar') self.obj_name = 'bar' self.target_name = 'bar.spec' si.utils.ensure_parents_exist(TEST_DIR)