示例#1
0
 def test_find_method_finds_the_given_representation(self):
     """testing if Representation.find() finds the latest version with the
     given representation.
     """
     rep = Representation(self.version1)
     result = rep.find('BBox')
     self.assertEqual(self.version5, result)
示例#2
0
 def test_version_attribute_is_working_properly(self):
     """testing if the version attribute is working properly
     """
     rep = Representation(self.version1)
     self.assertNotEqual(rep.version, self.version2)
     rep.version = self.version2
     self.assertEqual(rep.version, self.version2)
示例#3
0
 def test_find_method_finds_the_given_repr_from_different_repr(self):
     """testing if Representation.find() finds the latest version with the
     given representation from a different representation than the base one.
     """
     rep = Representation(self.version4)
     result = rep.find('ASS')
     self.assertEqual(self.version7, result)
示例#4
0
 def test_version_attribute_is_set_to_none(self):
     """testing if setting the version attribute to None is possible
     """
     rep = Representation(self.version1)
     self.assertFalse(rep.version is None)
     rep.version = None
     self.assertTrue(rep.version is None)
示例#5
0
 def test_find_method_finds_the_given_representation(self):
     """testing if Representation.find() finds the latest version with the
     given representation.
     """
     rep = Representation(self.version1)
     result = rep.find('BBox')
     self.assertEqual(self.version5, result)
示例#6
0
 def test_version_attribute_is_working_properly(self):
     """testing if the version attribute is working properly
     """
     rep = Representation(self.version1)
     self.assertNotEqual(rep.version, self.version2)
     rep.version = self.version2
     self.assertEqual(rep.version, self.version2)
示例#7
0
 def test_find_method_finds_the_given_repr_from_different_repr(self):
     """testing if Representation.find() finds the latest version with the
     given representation from a different representation than the base one.
     """
     rep = Representation(self.version4)
     result = rep.find('ASS')
     self.assertEqual(self.version7, result)
示例#8
0
 def test_version_attribute_is_set_to_none(self):
     """testing if setting the version attribute to None is possible
     """
     rep = Representation(self.version1)
     self.assertFalse(rep.version is None)
     rep.version = None
     self.assertTrue(rep.version is None)
示例#9
0
 def test_list_all_lists_all_representations_from_non_base_version(self):
     """testing if Representation.list_all() returns a list of strings
     showing the repr names by using non base version.
     """
     expected_result = ['Base', 'Hires', 'Midres', 'Lores']
     rep = Representation(self.version10)
     result = rep.list_all()
     self.assertEqual(sorted(expected_result), sorted(result))
示例#10
0
 def test_list_all_lists_all_representations(self):
     """testing if Representation.list_all() returns a list of strings
     showing the repr names.
     """
     expected_result = ['Base', 'BBox', 'ASS', 'GPU']
     rep = Representation(self.version1)
     result = rep.list_all()
     self.assertEqual(sorted(expected_result), sorted(result))
示例#11
0
 def test_list_all_lists_all_representations(self):
     """testing if Representation.list_all() returns a list of strings
     showing the repr names.
     """
     expected_result = ['Base', 'BBox', 'ASS', 'GPU']
     rep = Representation(self.version1)
     result = rep.list_all()
     self.assertEqual(sorted(expected_result), sorted(result))
示例#12
0
    def test_repr_property_is_working_properly(self):
        """testing if Representation.repr property is working properly
        """
        rep = Representation(self.version1)
        self.assertEqual(rep.repr, 'Base')

        rep = Representation(self.version4)
        self.assertTrue(rep.repr, 'BBox')
示例#13
0
    def test_is_base_method_is_working_properly(self):
        """testing if Representation.is_base() method is working properly
        """
        rep = Representation(self.version1)
        self.assertTrue(rep.is_base())

        rep = Representation(self.version4)
        self.assertFalse(rep.is_base())
示例#14
0
 def test_list_all_lists_all_representations_from_non_base_version(self):
     """testing if Representation.list_all() returns a list of strings
     showing the repr names by using non base version.
     """
     expected_result = ['Base', 'Hires', 'Midres', 'Lores']
     rep = Representation(self.version10)
     result = rep.list_all()
     self.assertEqual(sorted(expected_result), sorted(result))
示例#15
0
 def test_get_base_take_name_is_working_properly(self):
     """testing if the Representation.get_base_take_name() method is working
     properly
     """
     rep = Representation()
     self.assertEqual('Main', rep.get_base_take_name(self.version1))
     self.assertEqual('alt1', rep.get_base_take_name(self.version10))
     self.assertEqual('alt1', rep.get_base_take_name(self.version12))
     self.assertEqual('NoRepr', rep.get_base_take_name(self.version18))
示例#16
0
 def test_get_base_take_name_is_working_properly(self):
     """testing if the Representation.get_base_take_name() method is working
     properly
     """
     rep = Representation()
     self.assertEqual('Main', rep.get_base_take_name(self.version1))
     self.assertEqual('alt1', rep.get_base_take_name(self.version10))
     self.assertEqual('alt1', rep.get_base_take_name(self.version12))
     self.assertEqual('NoRepr', rep.get_base_take_name(self.version18))
示例#17
0
    def test_version_attribute_is_not_a_version_instance(self):
        """testing if a TypeError will be raised when the version attribute is
        set to a value other then None and a Version instance
        """
        rep = Representation()
        with self.assertRaises(TypeError) as cm:
            rep.version = 'not a version'

        self.assertEqual(
            'Representation.version should be a '
            'stalker.models.version.Version instance, not str',
            str(cm.exception))
示例#18
0
文件: extension.py 项目: yazici/anima
    def get_base(self):
        """returns the base version instance
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return True

        rep = Representation(version=v)
        return rep.find(rep.base_repr_name)
示例#19
0
文件: extension.py 项目: yazici/anima
    def is_base(self):
        """returns True or False depending to if this is the base
        representation for this reference
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return True

        rep = Representation(version=v)
        return rep.is_base()
示例#20
0
    def test_version_attribute_is_not_a_version_instance(self):
        """testing if a TypeError will be raised when the version attribute is
        set to a value other then None and a Version instance
        """
        rep = Representation()
        with self.assertRaises(TypeError) as cm:
            rep.version = 'not a version'

        self.assertEqual(
            'Representation.version should be a '
            'stalker.models.version.Version instance, not str',
            str(cm.exception)
        )
示例#21
0
    def test_is_repr_method_is_working_properly(self):
        """testing if Representation.is_repr() method is working properly
        """
        rep = Representation(self.version1)
        self.assertTrue(rep.is_repr('Base'))

        rep = Representation(self.version4)
        self.assertFalse(rep.is_repr('Base'))

        rep = Representation(self.version4)
        self.assertTrue(rep.is_repr('BBox'))
示例#22
0
文件: extension.py 项目: yazici/anima
    def has_repr(self, repr_name):
        """checks if the reference has the given representation

        :param str repr_name: The name of the desired representation
        :return:
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return False

        rep = Representation(version=v)
        return rep.has_repr(repr_name)
示例#23
0
文件: extension.py 项目: yazici/anima
    def list_all_repr(self):
        """Returns a list of strings representing all the representation names
        of this FileReference

        :return: list of str
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return []

        rep = Representation(version=v)
        return rep.list_all()
示例#24
0
文件: extension.py 项目: yazici/anima
    def is_repr(self, repr_name):
        """returns True or False depending to if this is the requested repr

        :param str repr_name: The representation name
        :return:
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return False

        rep = Representation(version=v)
        return rep.is_repr(repr_name=repr_name)
示例#25
0
文件: extension.py 项目: yazici/anima
    def find_repr(self, repr_name):
        """Finds the representation with the given repr_name.

        :param str repr_name: The desired repr name
        :return: :class:`.Version`
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return

        rep = Representation(version=v)
        rep_v = rep.find(repr_name)

        return rep_v
示例#26
0
    def test_version_argument_is_not_a_version_instance(self):
        """testing if a TypeError will be raised when the version argument is
        not a Version instance
        """
        with self.assertRaises(TypeError) as cm:
            Representation('not a version')

        self.assertEqual(
            'Representation.version should be a '
            'stalker.models.version.Version instance, not str',
            str(cm.exception))
示例#27
0
文件: extension.py 项目: yazici/anima
    def repr(self):
        """the representation name of the related version
        """
        from anima.env.mayaEnv import Maya
        m = Maya()
        v = m.get_version_from_full_path(self.path)

        if v is None:
            return None

        rep = Representation(version=v)
        return rep.repr
示例#28
0
    def test_has_repr_method_is_working_properly(self):
        """testing if Representation.has_repr() method is working properly
        """
        rep = Representation(self.version1)
        self.assertTrue(rep.has_repr('BBox'))

        rep.version = self.version17
        self.assertTrue(rep.has_repr('Lores'))

        rep.version = self.version19
        self.assertFalse(rep.has_repr('BBox'))
示例#29
0
    def test_has_repr_method_is_working_properly(self):
        """testing if Representation.has_repr() method is working properly
        """
        rep = Representation(self.version1)
        self.assertTrue(rep.has_repr('BBox'))

        rep.version = self.version17
        self.assertTrue(rep.has_repr('Lores'))

        rep.version = self.version19
        self.assertFalse(rep.has_repr('BBox'))
示例#30
0
 def test_find_method_returns_none_for_invalid_repr_name(self):
     """testing if Representation.find() returns None for invalid or
     nonexistent repr name
     """
     rep = Representation(self.version4)
     self.assertTrue(rep.find('NonExists') is None)
示例#31
0
 def test_version_argument_is_skipped(self):
     """testing if it is possible to skip the version argument
     """
     rep = Representation()
     self.assertTrue(rep.version is None)
示例#32
0
 def test_find_method_returns_none_for_invalid_repr_name(self):
     """testing if Representation.find() returns None for invalid or
     nonexistent repr name
     """
     rep = Representation(self.version4)
     self.assertTrue(rep.find('NonExists') is None)
示例#33
0
 def test_version_argument_is_none(self):
     """testing if the version argument can be None
     """
     rep = Representation(None)
     self.assertTrue(rep.version is None)
示例#34
0
 def test_version_argument_is_working_properly(self):
     """testing if the version argument value is correctly passed to the
     version attribute
     """
     rep = Representation(self.version1)
     self.assertEqual(rep.version, self.version1)