当前位置: 首页>>代码示例>>Python>>正文


Python Locator.get_object_directory方法代码示例

本文整理汇总了Python中pystache.locator.Locator.get_object_directory方法的典型用法代码示例。如果您正苦于以下问题:Python Locator.get_object_directory方法的具体用法?Python Locator.get_object_directory怎么用?Python Locator.get_object_directory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pystache.locator.Locator的用法示例。


在下文中一共展示了Locator.get_object_directory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_object_directory__not_hasattr_module

# 需要导入模块: from pystache.locator import Locator [as 别名]
# 或者: from pystache.locator.Locator import get_object_directory [as 别名]
    def test_get_object_directory__not_hasattr_module(self):
        locator = Locator()

        obj = datetime(2000, 1, 1)
        self.assertFalse(hasattr(obj, "__module__"))
        self.assertEquals(locator.get_object_directory(obj), None)

        self.assertFalse(hasattr(None, "__module__"))
        self.assertEquals(locator.get_object_directory(None), None)
开发者ID:clach04,项目名称:pystache,代码行数:11,代码来源:test_locator.py

示例2: test_get_object_directory

# 需要导入模块: from pystache.locator import Locator [as 别名]
# 或者: from pystache.locator.Locator import get_object_directory [as 别名]
    def test_get_object_directory(self):
        locator = Locator()

        obj = SayHello()
        actual = locator.get_object_directory(obj)

        self.assertEquals(actual, os.path.abspath(DATA_DIR))
开发者ID:clach04,项目名称:pystache,代码行数:9,代码来源:test_locator.py

示例3: test_get_object_directory

# 需要导入模块: from pystache.locator import Locator [as 别名]
# 或者: from pystache.locator.Locator import get_object_directory [as 别名]
    def test_get_object_directory(self):
        locator = Locator()

        obj = SayHello()
        actual = locator.get_object_directory(obj)

        self._assert_paths(actual, DATA_DIR)
开发者ID:SvetlanaM,项目名称:EnabledCityPaloAlto,代码行数:9,代码来源:test_locator.py

示例4: test_get_object_directory

# 需要导入模块: from pystache.locator import Locator [as 别名]
# 或者: from pystache.locator.Locator import get_object_directory [as 别名]
    def test_get_object_directory(self):
        locator = Locator()

        reader = Reader()
        actual = locator.get_object_directory(reader)

        expected = os.path.join(os.path.dirname(__file__), os.pardir, 'pystache')

        self.assertEquals(os.path.normpath(actual), os.path.normpath(expected))
开发者ID:jakearchibald,项目名称:pystache,代码行数:11,代码来源:test_locator.py

示例5: test_find_object__none_object_directory

# 需要导入模块: from pystache.locator import Locator [as 别名]
# 或者: from pystache.locator.Locator import get_object_directory [as 别名]
    def test_find_object__none_object_directory(self):
        locator = Locator()

        obj = None
        self.assertEquals(None, locator.get_object_directory(obj))

        actual = locator.find_object(search_dirs=[DATA_DIR], obj=obj, file_name="say_hello.mustache")
        expected = os.path.join(DATA_DIR, "say_hello.mustache")

        self.assertEquals(actual, expected)
开发者ID:clach04,项目名称:pystache,代码行数:12,代码来源:test_locator.py

示例6: test_get_object_directory__not_hasattr_module

# 需要导入模块: from pystache.locator import Locator [as 别名]
# 或者: from pystache.locator.Locator import get_object_directory [as 别名]
    def test_get_object_directory__not_hasattr_module(self):
        locator = Locator()

        # Previously, we used a genuine object -- a datetime instance --
        # because datetime instances did not have the __module__ attribute
        # in CPython.  See, for example--
        #
        #   http://bugs.python.org/issue15223
        #
        # However, since datetime instances do have the __module__ attribute
        # in PyPy, we needed to switch to something else once we added
        # support for PyPi.  This was so that our test runs would pass
        # in all systems.
        obj = "abc"
        self.assertFalse(hasattr(obj, '__module__'))
        self.assertEqual(locator.get_object_directory(obj), None)

        self.assertFalse(hasattr(None, '__module__'))
        self.assertEqual(locator.get_object_directory(None), None)
开发者ID:SvetlanaM,项目名称:EnabledCityPaloAlto,代码行数:21,代码来源:test_locator.py


注:本文中的pystache.locator.Locator.get_object_directory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。