Beispiel #1
0
def test_world_should_be_able_to_absorb_lambdas():
    "world should be able to absorb lambdas"
    assert not hasattr(world, 'named_func')

    world.absorb(lambda: 'absorbed', 'named_func')

    assert hasattr(world, 'named_func')
    assert isinstance(world.named_func, collections.Callable)

    assert_equals(world.named_func(), 'absorbed')

    world.spew('named_func')

    assert not hasattr(world, 'named_func')
Beispiel #2
0
def test_world_should_be_able_to_absorb_lambdas():
    u"world should be able to absorb lambdas"
    assert not hasattr(world, 'named_func')

    world.absorb(lambda: 'absorbed', 'named_func')

    assert hasattr(world, 'named_func')
    assert callable(world.named_func)

    assert_equals(world.named_func(), 'absorbed')

    world.spew('named_func')

    assert not hasattr(world, 'named_func')
Beispiel #3
0
def test_world_should_be_able_to_absorb_lambdas():
    u"world should be able to absorb lambdas"
    assert not hasattr(world, 'named_func')

    world.absorb(lambda: 'absorbed', 'named_func')

    assert hasattr(world, 'named_func')
    assert callable(world.named_func)

    assert_equals(world.named_func(), 'absorbed')

    world.spew('named_func')

    assert not hasattr(world, 'named_func')
Beispiel #4
0
def test_world_should_be_able_to_absorb_lambdas():
    "world should be able to absorb lambdas"
    assert not hasattr(world, 'named_func')

    world.absorb(lambda: 'absorbed', 'named_func')

    assert hasattr(world, 'named_func')
    assert isinstance(world.named_func, collections.Callable)

    assert_equals(world.named_func(), 'absorbed')

    world.spew('named_func')

    assert not hasattr(world, 'named_func')
Beispiel #5
0
def test_world_should_be_able_to_absorb_classs():
   u"world should be able to absorb classs"
   assert not hasattr(world, 'MyClass')

   @world.absorb
   class MyClass:
       pass

   assert hasattr(world, 'MyClass')
   assert_equals(world.MyClass, MyClass)

   assert isinstance(world.MyClass(), MyClass)

   world.spew('MyClass')

   assert not hasattr(world, 'MyClass')
Beispiel #6
0
def test_world_should_be_able_to_absorb_functions():
    u"world should be able to absorb functions"
    assert not hasattr(world, 'function1')

    @world.absorb
    def function1():
        return 'absorbed'

    assert hasattr(world, 'function1')
    assert callable(world.function1)

    assert_equals(world.function1(), 'absorbed')

    world.spew('function1')

    assert not hasattr(world, 'function1')
Beispiel #7
0
def test_world_should_be_able_to_absorb_functions():
    u"world should be able to absorb functions"
    assert not hasattr(world, 'function1')

    @world.absorb
    def function1():
        return 'absorbed'

    assert hasattr(world, 'function1')
    assert callable(world.function1)

    assert_equals(world.function1(), 'absorbed')

    world.spew('function1')

    assert not hasattr(world, 'function1')
Beispiel #8
0
def test_world_should_be_able_to_absorb_classs():
   u"world should be able to absorb class"
   assert not hasattr(world, 'MyClass')

   @world.absorb
   class MyClass:
       pass

   assert hasattr(world, 'MyClass')
   assert_equals(world.MyClass, MyClass)

   assert isinstance(world.MyClass(), MyClass)

   world.spew('MyClass')

   assert not hasattr(world, 'MyClass')
Beispiel #9
0
def test_world_should_be_able_to_absorb_classs():
   "world should be able to absorb class"
   assert not hasattr(world, 'MyClass')

   if sys.version_info < (2, 6):
       return

   class MyClass:
       pass

   world.absorb(MyClass)

   assert hasattr(world, 'MyClass')
   assert_equals(world.MyClass, MyClass)

   assert isinstance(world.MyClass(), MyClass)

   world.spew('MyClass')

   assert not hasattr(world, 'MyClass')
Beispiel #10
0
def test_world_should_be_able_to_absorb_classs():
    u"world should be able to absorb class"
    assert not hasattr(world, 'MyClass')

    if sys.version_info < (2, 6):
        return

    class MyClass:
        pass

    world.absorb(MyClass)

    assert hasattr(world, 'MyClass')
    assert_equals(world.MyClass, MyClass)

    assert isinstance(world.MyClass(), MyClass)

    world.spew('MyClass')

    assert not hasattr(world, 'MyClass')