예제 #1
0
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()),
            ],
        ))
예제 #2
0
def test_base_simulation_cannot_be_instantiated_because_abstract():
    with pytest.raises(TypeError):
        si.Specification("dummy").to_sim()
예제 #3
0
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"
예제 #4
0
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())
            ]))
예제 #5
0
 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)
예제 #6
0
 def setUp(self):
     self.obj = si.Specification('bar')
     self.obj_name = 'bar'
     self.target_name = 'bar.spec'
     si.utils.ensure_parents_exist(TEST_DIR)