Esempio n. 1
0
 def returns_unique_Collection_objects_for_same_input_module(self):
     # Ignoring self.c for now, just in case it changes later.
     # First, a module with no root NS
     mod = load('integration')
     c1 = Collection.from_module(mod)
     c2 = Collection.from_module(mod)
     assert c1 is not c2
     # Now one *with* a root NS (which was previously buggy)
     mod2 = load('explicit_root')
     c3 = Collection.from_module(mod2)
     c4 = Collection.from_module(mod2)
     assert c3 is not c4
Esempio n. 2
0
 def returns_unique_Collection_objects_for_same_input_module(self):
     # Ignoring self.c for now, just in case it changes later.
     # First, a module with no root NS
     mod = load('integration')
     c1 = Collection.from_module(mod)
     c2 = Collection.from_module(mod)
     assert c1 is not c2
     # Now one *with* a root NS (which was previously buggy)
     mod2 = load('explicit_root')
     c3 = Collection.from_module(mod2)
     c4 = Collection.from_module(mod2)
     assert c3 is not c4
Esempio n. 3
0
 def devuelve_objs_Coleccion_unicos_para_el_mismo_modulo_de_entrada(
         self):
     # Ignorando self.c por ahora, en caso de que cambie más tarde.
     # Primero, un módulo sin raíz Hangar
     mod = load("integracion")
     c1 = Coleccion.del_modulo(mod)
     c2 = Coleccion.del_modulo(mod)
     assert c1 is not c2
     # Ahora uno *con* una raíz Hangar (que anteriormente tenía errores)
     mod2 = load("raiz_explicita")
     c3 = Coleccion.del_modulo(mod2)
     c4 = Coleccion.del_modulo(mod2)
     assert c3 is not c4
Esempio n. 4
0
 def honors_subcollection_default_tasks_on_subcollection_name(self):
     sub = Collection.from_module(load("decorators"))
     self.c.add_collection(sub)
     # Sanity
     assert self.c["decorators.biz"] is sub["biz"]
     # Real test
     assert self.c["decorators"] is self.c["decorators.biz"]
Esempio n. 5
0
 def honors_subcollection_default_tasks_on_subcollection_name(self):
     sub = Collection.from_module(load('decorator'))
     self.c.add_collection(sub)
     # Sanity
     assert self.c['decorator.biz'] is sub['biz']
     # Real test
     assert self.c['decorator'] is self.c['decorator.biz']
Esempio n. 6
0
 def honors_subcollection_default_tasks_on_subcollection_name(self):
     sub = Collection.from_module(load('decorators'))
     self.c.add_collection(sub)
     # Sanity
     assert self.c['decorators.biz'] is sub['biz']
     # Real test
     assert self.c['decorators'] is self.c['decorators.biz']
Esempio n. 7
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load('integration'))
     expect(
         'print_foo',
         out='foo\n',
         program=Program(namespace=ns),
     )
Esempio n. 8
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load('integration'))
     expect(
         'print-foo',
         out='foo\n',
         program=Program(namespace=ns),
     )
Esempio n. 9
0
 def respeta_los_artefactos_pordefecto_de_la_subcoleccion_en_el_nombre_de_la_subcoleccion(
         self):
     sub = Coleccion.del_modulo(load("decoradores"))
     self.c.ad_coleccion(sub)
     # Sanity
     assert self.c["decoradores.biz"] is sub["biz"]
     # Real prueba
     assert self.c["decoradores"] is self.c["decoradores.biz"]
Esempio n. 10
0
 def invalid_path(self):
     # This is really just testing Lexicon/dict behavior but w/e, good
     # to be explicit, esp if we ever want this to become Exit or
     # another custom exception. (For now most/all callers manually
     # catch KeyError and raise Exit just to keep most Exit use high up
     # in the stack...)
     with raises(KeyError):
         collection = Collection.from_module(load("tree"))
         collection.subcollection_from_path("lol.whatever.man")
Esempio n. 11
0
 def invalid_path(self):
     # This is really just testing Lexicon/dict behavior but w/e, good
     # to be explicit, esp if we ever want this to become Exit or
     # another custom exception. (For now most/all callers manually
     # catch KeyError and raise Exit just to keep most Exit use high up
     # in the stack...)
     with raises(KeyError):
         collection = Collection.from_module(load('tree'))
         collection.subcollection_from_path('lol.whatever.man')
Esempio n. 12
0
 def Ruta_no_valida(self):
     # Esto realmente es solo probar el comportamiento de Lexicon/dict,
     # pero bueno, bueno ser explícito, especialmente si alguna vez
     # queremos que esto se convierta en Salida u otra excepción
     # personalizada. (Por ahora, la mayoría / todas las personas que
     # llaman capturan manualmente KeyError y generan Salida solo para
     # mantener la mayoría del uso de Salida en lo alto del stack ...)
     with raises(KeyError):
         coleccion = Coleccion.del_modulo(load("arbol"))
         coleccion.subcoleccion_desde_ruta("jeje.cualquier.pieza")
Esempio n. 13
0
 def setup(self):
     mod = load('explicit_root')
     mod.ns.configure({
         'key': 'builtin',
         'otherkey': 'yup',
         'subconfig': {'mykey': 'myvalue'}
     })
     mod.ns.name = 'builtin_name'
     self.unchanged = Collection.from_module(mod)
     self.changed = Collection.from_module(
         mod,
         name='override_name',
         config={
             'key': 'override',
             'subconfig': {'myotherkey': 'myothervalue'}
         }
     )
Esempio n. 14
0
 def setup(self):
     mod = load('explicit_root')
     mod.ns.configure({
         'key': 'builtin',
         'otherkey': 'yup',
         'subconfig': {'mykey': 'myvalue'}
     })
     mod.ns.name = 'builtin_name'
     self.unchanged = Collection.from_module(mod)
     self.changed = Collection.from_module(
         mod,
         name='override_name',
         config={
             'key': 'override',
             'subconfig': {'myotherkey': 'myothervalue'}
         }
     )
Esempio n. 15
0
 def setup(self):
     mod = load("explicit_root")
     mod.ns.configure(
         {
             "key": "builtin",
             "otherkey": "yup",
             "subconfig": {"mykey": "myvalue"},
         }
     )
     mod.ns.name = "builtin_name"
     self.unchanged = Collection.from_module(mod)
     self.changed = Collection.from_module(
         mod,
         name="override_name",
         config={
             "key": "override",
             "subconfig": {"myotherkey": "myothervalue"},
         },
     )
Esempio n. 16
0
 def setup(self):
     mod = load("explicit_root")
     mod.ns.configure({
         "key": "builtin",
         "otherkey": "yup",
         "subconfig": {
             "mykey": "myvalue"
         },
     })
     mod.ns.name = "builtin_name"
     self.unchanged = Collection.from_module(mod)
     self.changed = Collection.from_module(
         mod,
         name="override_name",
         config={
             "key": "override",
             "subconfig": {
                 "myotherkey": "myothervalue"
             },
         },
     )
Esempio n. 17
0
 def setup(self):
     mod = load("raiz_explicita")
     mod.hng.configurar({
         "clave": "incorporado",
         "otraclave": "yup",
         "subconfig": {
             "miclave": "mivalor"
         },
     })
     mod.hng.nombre = "builtin_name"
     self.nocambiado = Coleccion.del_modulo(mod)
     self.cambiado = Coleccion.del_modulo(
         mod,
         nombre="anular_nombre",
         config={
             "clave": "anular",
             "subconfig": {
                 "miotraclave": "miotrovalor"
             },
         },
     )
Esempio n. 18
0
 def ruta_anidada(self):
     coleccion = Coleccion.del_modulo(load("arbol"))
     docs = coleccion.colecciones["fabric"].colecciones["docs"]
     assert coleccion.subcoleccion_desde_ruta("fabric.docs") is docs
Esempio n. 19
0
 def top_level_path(self):
     collection = Collection.from_module(load('tree'))
     build = collection.collections['build']
     assert collection.subcollection_from_path('build') is build
Esempio n. 20
0
 def works_great_with_subclassing(self):
     class MyCollection(Collection):
         pass
     c = MyCollection.from_module(load('integration'))
     assert isinstance(c, MyCollection)
Esempio n. 21
0
 def setup(self):
     self.c = Collection.from_module(load('integration'))
Esempio n. 22
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load("integration"))
     expect("print-foo", out="foo\n", program=Program(namespace=ns))
Esempio n. 23
0
 def top_level_path(self):
     collection = Collection.from_module(load("tree"))
     build = collection.collections["build"]
     assert collection.subcollection_from_path("build") is build
Esempio n. 24
0
 def nested_path(self):
     collection = Collection.from_module(load("tree"))
     docs = collection.collections["build"].collections["docs"]
     assert collection.subcollection_from_path("build.docs") is docs
Esempio n. 25
0
 def top_level_path(self):
     collection = Collection.from_module(load("tree"))
     build = collection.collections["build"]
     assert collection.subcollection_from_path("build") is build
Esempio n. 26
0
 def may_specify_namespace(self):
     foo = load("foo")
     assert Program(namespace=foo).namespace is foo
Esempio n. 27
0
 def honors_subcollection_task_aliases(self):
     self.c.add_collection(load("decorators"))
     assert "decorators.bar" in self.c
Esempio n. 28
0
 def honors_explicit_collections(self):
     coll = Collection.from_module(load("explicit_root"))
     assert "top-level" in coll.tasks
     assert "sub-level" in coll.collections
     # The real key test
     assert "sub-task" not in coll.tasks
Esempio n. 29
0
        def works_great_with_subclassing(self):
            class MyCollection(Collection):
                pass

            c = MyCollection.from_module(load("integration"))
            assert isinstance(c, MyCollection)
Esempio n. 30
0
 def can_take_module_objects(self):
     self.c.add_collection(load('integration'))
     assert 'integration' in self.c.collections
Esempio n. 31
0
 def honors_subcollection_task_aliases(self):
     self.c.add_collection(load('decorator'))
     assert 'decorator.bar' in self.c
Esempio n. 32
0
 def nested_path(self):
     collection = Collection.from_module(load("tree"))
     docs = collection.collections["build"].collections["docs"]
     assert collection.subcollection_from_path("build.docs") is docs
Esempio n. 33
0
 def setup(self):
     self.c = Collection.from_module(load('explicit_root'))
Esempio n. 34
0
 def setup(self):
     self.c = Collection.from_module(load('explicit_root'))
Esempio n. 35
0
 def may_specify_namespace(self):
     foo = load('foo')
     ok_(Program(namespace=foo).namespace is foo)
Esempio n. 36
0
 def nested_path(self):
     collection = Collection.from_module(load('tree'))
     docs = collection.collections['build'].collections['docs']
     assert collection.subcollection_from_path('build.docs') is docs
Esempio n. 37
0
 def may_specify_namespace(self):
     foo = load("foo")
     assert Program(namespace=foo).namespace is foo
Esempio n. 38
0
 def allows_tasks_with_explicit_names_to_override_bound_name(self):
     coll = Collection.from_module(load('subcollection_task_name'))
     assert 'explicit-name' in coll.tasks # not 'implicit_name'
Esempio n. 39
0
 def setup(self):
     self.mod = load('integration')
     self.from_module = Collection.from_module
Esempio n. 40
0
 def honors_subcollection_task_aliases(self):
     self.c.add_collection(load('decorators'))
     assert 'decorators.bar' in self.c
Esempio n. 41
0
 def honors_explicit_collections(self):
     coll = Collection.from_module(load('explicit_root'))
     assert 'top-level' in coll.tasks
     assert 'sub-level' in coll.collections
     # The real key test
     assert 'sub-task' not in coll.tasks
Esempio n. 42
0
 def nested_path(self):
     collection = Collection.from_module(load('tree'))
     docs = collection.collections['build'].collections['docs']
     assert collection.subcollection_from_path('build.docs') is docs
Esempio n. 43
0
 def honors_subcollection_task_aliases(self):
     self.c.add_collection(load("decorators"))
     assert "decorators.bar" in self.c
Esempio n. 44
0
 def honors_explicit_collections(self):
     coll = Collection.from_module(load('explicit_root'))
     assert 'top-level' in coll.tasks
     assert 'sub-level' in coll.collections
     # The real key test
     assert 'sub-task' not in coll.tasks
Esempio n. 45
0
 def can_take_module_objects(self):
     self.c.add_collection(load('integration'))
     assert 'integration' in self.c.collections
Esempio n. 46
0
 def allows_tasks_with_explicit_names_to_override_bound_name(self):
     coll = Collection.from_module(load('subcollection_task_name'))
     assert 'explicit-name' in coll.tasks  # not 'implicit_name'
Esempio n. 47
0
 def explicit_namespace_works_correctly(self):
     # Regression-ish test re #288
     ns = Collection.from_module(load("integration"))
     expect("print-foo", out="foo\n", program=Program(namespace=ns))
Esempio n. 48
0
 def ruta_de_nivel_superior(self):
     coleccion = Coleccion.del_modulo(load("arbol"))
     fabric = coleccion.colecciones["fabric"]
     assert coleccion.subcoleccion_desde_ruta("fabric") is fabric
Esempio n. 49
0
 def top_level_path(self):
     collection = Collection.from_module(load('tree'))
     build = collection.collections['build']
     assert collection.subcollection_from_path('build') is build
Esempio n. 50
0
 def setup(self):
     self.c = Collection.from_module(load('integration'))
Esempio n. 51
0
 def setup(self):
     self.mod = load('integration')
     self.from_module = Collection.from_module
Esempio n. 52
0
 def honors_explicit_collections(self):
     coll = Collection.from_module(load("explicit_root"))
     assert "top-level" in coll.tasks
     assert "sub-level" in coll.collections
     # The real key test
     assert "sub-task" not in coll.tasks