Esempio n. 1
0
 def models(self):
     """Access to the various models of daaltk"""
     return get_lazy_loader(self,
                            "models",
                            parent_path=self._parent_path,
                            package_name=self._package_name,
                            implicit_kwargs={'tc': self})
Esempio n. 2
0
 def operations(self):
     """Access to the various operations of daaltk"""
     return get_lazy_loader(self,
                            "operations",
                            parent_path=self._parent_path,
                            package_name=self._package_name,
                            implicit_kwargs={
                                'tc': self
                            }).operations
Esempio n. 3
0
 def test_get_lazy_loader(self):
     class Dummy(object):
         pass
     dummy = Dummy()
     loader = ll.get_lazy_loader(dummy, "tests")  # use the sparktk tests subpackage
     self.assertTrue(isinstance(loader, ll.LazyLoader))
     # see if it has a property for this module
     self.assertEqual('SparktkTestsTest_lazyloaderLazyLoader', type(loader.test_lazyloader).__name__)
     # see if we can call the module level multiply method
     self.assertEqual(loader.test_lazyloader.multiply_for_lazy_loader(3, 4), 12)
     # see if class is the same class as if we imported it directly
     from sparktk.tests.test_lazyloader import TestLazyLoader as ImportedLoader
     self.assertTrue(loader.test_lazyloader.TestLazyLoader is ImportedLoader)
Esempio n. 4
0
    def test_get_lazy_loader_with_implicit_kwargs(self):
        class Dummy(object):
            pass
        dummy = Dummy()

        def base10(x):
            return "base10(%s)" % x

        loader = ll.get_lazy_loader(dummy, "tests", implicit_kwargs={'base': base10})  # specify implicit value
        self.assertTrue(isinstance(loader, ll.LazyLoader))
        # see if it has a property for this module
        self.assertEqual('SparktkTestsTest_lazyloaderLazyLoader', type(loader.test_lazyloader).__name__)
        # see if we can call the module level multiply method
        self.assertEqual(loader.test_lazyloader.multiply_with_implicit_kwarg(5, 7), "base10(35)")
Esempio n. 5
0
    def test_get_lazy_loader(self):
        class Dummy(object):
            pass

        dummy = Dummy()
        loader = ll.get_lazy_loader(
            dummy, "tests")  # use the sparktk tests subpackage
        self.assertTrue(isinstance(loader, ll.LazyLoader))
        # see if it has a property for this module
        self.assertEqual('SparktkTestsTest_lazyloaderLazyLoader',
                         type(loader.test_lazyloader).__name__)
        # see if we can call the module level multiply method
        self.assertEqual(loader.test_lazyloader.multiply_for_lazy_loader(3, 4),
                         12)
        # see if class is the same class as if we imported it directly
        from sparktk.tests.test_lazyloader import TestLazyLoader as ImportedLoader
        self.assertTrue(
            loader.test_lazyloader.TestLazyLoader is ImportedLoader)
Esempio n. 6
0
    def test_get_lazy_loader_with_implicit_kwargs(self):
        class Dummy(object):
            pass

        dummy = Dummy()

        def base10(x):
            return "base10(%s)" % x

        loader = ll.get_lazy_loader(
            dummy, "tests", implicit_kwargs={'base':
                                             base10})  # specify implicit value
        self.assertTrue(isinstance(loader, ll.LazyLoader))
        # see if it has a property for this module
        self.assertEqual('SparktkTestsTest_lazyloaderLazyLoader',
                         type(loader.test_lazyloader).__name__)
        # see if we can call the module level multiply method
        self.assertEqual(
            loader.test_lazyloader.multiply_with_implicit_kwarg(5, 7),
            "base10(35)")