How to use Fileseq - 10 common examples

To help you get started, we’ve selected a few Fileseq examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check_union(self, test, expect):
        """
        Harness to test if the FrameSet.union call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        # the union of the empty FrameSet with any other is always the other
        if not test and not expect:
            self.assertEqual(f.union(FrameSet('1')), FrameSet('1'))
            self.assertEqual(f.union(FrameSet('-1')), FrameSet('-1'))
            self.assertEqual(f.union(expect), FrameSet.from_iterable(expect, sort=True))
            return
        for v in [[expect[0]], expect, expect + [max(expect)+1], [i + max(expect) + 1 for i in expect]]:
            t = FrameSet.from_iterable(v)
            r = f.union(t)
            e = FrameSet.from_iterable(set(expect).union(v), sort=True)
            m = u'FrameSet("{0}").union(FrameSet("{1}")) != {2}'
            self.assertEqual(r, e, m.format(t, f, e))
            m = u'FrameSet("{0}").union(FrameSet("{1}")) returns {2}: got {3}'
            self.assertIsInstance(r, FrameSet, m.format(test, t, FrameSet, type(r)))
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check_difference(self, test, expect):
        """
        Harness to test if the FrameSet.difference call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        # the difference of the empty FrameSet with any other is always the empty FrameSet
        if not test and not expect:
            self.assertEqual(f.intersection(FrameSet('1')), f)
            self.assertEqual(f.intersection(FrameSet('-1')), f)
            self.assertEqual(f.intersection(expect), f)
            return
        for v in [[expect[0]], expect, expect + [max(expect)+1], [i + max(expect) + 1 for i in expect]]:
            t = FrameSet.from_iterable(v)
            r = f.difference(t)
            e = FrameSet.from_iterable(set(expect).difference(v), sort=True)
            m = u'FrameSet("{0}").difference(FrameSet("{1}")) != {2}'
            self.assertEqual(r, e, m.format(t, f, e))
            m = u'FrameSet("{0}").difference(FrameSet("{1}")) returns {2}: got {3}'
            self.assertIsInstance(r, FrameSet, m.format(test, t, FrameSet, type(r)))
github chadmv / blueprint / tests / test_module_maya.py View on Github external
def testSetup(self):
        self.job.setup()
        self.job.getLayer("foo").execute(fileseq.FrameSet("1-1"))
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check___ne__(self, test, expect):
        """
        Harness to test if the FrameSet.__ne__ call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        # the empty FrameSet is not equal to anything, except for itself
        if not test and not expect:
            self.assertTrue(f != FrameSet('1'))
            self.assertTrue(f != FrameSet('-1'))
            self.assertFalse(f != expect)
            return
        r = FrameSet(','.join((str(i) for i in (expect + [max(expect) + 1]))))
        should_succeed = f != r
        m = u'FrameSet("{0}") != FrameSet("{1}")'
        self.assertTrue(should_succeed, m.format(test, r))
        m = u'FrameSet("{0}") != FrameSet("{1}") returns {2}: got {3}'
        self.assertIsInstance(should_succeed, bool, m.format(test, r, bool, type(should_succeed)))
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check___le__(self, test, expect):
        """
        Harness to test if the FrameSet.__le__ call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        # the empty FrameSet is less than everything, equal only to itself
        if not test and not expect:
            self.assertTrue(f <= FrameSet('1'))
            self.assertTrue(f <= FrameSet('-1'))
            self.assertTrue(f <= expect)
            return
        for i in [expect, expect + [max(expect) + 1]]:
            r = FrameSet.from_iterable(i)
            should_succeed = f <= r
            m = u'FrameSet("{0}") <= FrameSet("{1}")'
            self.assertTrue(should_succeed, m.format(test, r))
            m = u'FrameSet("{0}") <= FrameSet("{1}") returns {2}: got {3}'
            self.assertIsInstance(should_succeed, bool, m.format(test, r, bool, type(should_succeed)))
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check___lt__(self, test, expect):
        """
        Harness to test if the FrameSet.__lt__ call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        # the empty FrameSet is less than everything, except for itself
        if not test and not expect:
            self.assertTrue(f < FrameSet('1'))
            self.assertTrue(f < FrameSet('-1'))
            self.assertFalse(f < expect)
            return
        r = FrameSet.from_iterable(expect + [max(expect) + 1])
        should_succeed = f < r
        should_fail = r < f
        m = u'FrameSet("{0}") < FrameSet("{1}")'
        self.assertTrue(should_succeed, m.format(test, r))
        self.assertFalse(should_fail, m.format(r, test))
        m = u'FrameSet("{0}") < FrameSet("{1}") returns {2}: got {3}'
        self.assertIsInstance(should_succeed, bool, m.format(test, r, bool, type(should_succeed)))
        self.assertIsInstance(should_fail, bool, m.format(r, test, bool, type(should_fail)))
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check___ge__(self, test, expect):
        """
        Harness to test if the FrameSet.__ge__ call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        # the empty FrameSet is greater than nothing, except for itself
        if not test and not expect:
            self.assertFalse(f >= FrameSet('1'))
            self.assertFalse(f >= FrameSet('-1'))
            self.assertTrue(f >= expect)
            return
        for i in [expect, expect[:-1]]:
            try:
                r = FrameSet.from_iterable(i)
            except ParseException:
                # this will happen if len(expect) == 1
                continue
            should_succeed = f >= r
            m = u'FrameSet("{0}") >= FrameSet("{1}"'
            self.assertTrue(should_succeed, m.format(test, r))
            m = u'FrameSet("{0}") >= FrameSet("{1}") returns {2}: got {3}'
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check___str__(self, test, expect):
        """
        Harness to test if the FrameSet.__str__ call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        m = u'str(FrameSet("{0}")) != {0}: got {1}'
        r = str(f)
        self.assertEqual(r, native_str(test), m.format(test, r))
        m = u'str(FrameSet("{0}")) returns {1}: got {2}'
        self.assertIsInstance(r, native_str, m.format(test, native_str, type(r)))
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check_copy(self, test, expect):
        """
        Harness to test if the FrameSet.copy call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        r = f.copy()
        self.assertIsNot(f, r)
        self.assertEqual(f, r)
github justinfx / fileseq / test / test_fuzz.py View on Github external
def _check___rxor__(self, test, expect):
        """
        Harness to test if the FrameSet.__rxor__ call works properly.
        :param test: the string to pass to FrameSet
        :param expect: the expected list of values that FrameSet will hold
        :return: None
        """
        f = FrameSet(test)
        v = [i + max(expect) + 1 for i in expect] or list(range(999, 1999))
        t = FrameSet.from_iterable(v)
        r = t ^ f
        e = FrameSet.from_iterable(set(v) ^ set(expect), sort=True)
        m = u'FrameSet("{0}") ^ FrameSet("{1}") != FrameSet("{2}")'
        self.assertEqual(r, e, m.format(t, f, e))
        m = u'FrameSet("{0}") ^ FrameSet("{1}") returns {2}: got {3}'
        self.assertIsInstance(r, FrameSet, m.format(t, test, FrameSet, type(r)))