Exemplo n.º 1
0
    def test_no_owner(self):
        logging.debug("")
        logging.debug("test_no_owner")

        # Absolute FileRef.
        path = os.path.join(os.sep, "xyzzy")
        ref = FileRef(path)
        try:
            ref.open()
        except ValueError, exc:
            msg = "Path '%s' is absolute and no path checker is available." % path
            self.assertEqual(str(exc), msg)
Exemplo n.º 2
0
    def test_no_owner(self):
        logging.debug('')
        logging.debug('test_no_owner')

        # Absolute FileRef.
        path = os.path.join(os.sep, 'xyzzy')
        ref = FileRef(path)
        try:
            ref.open()
        except ValueError, exc:
            msg = "Path '%s' is absolute and no path checker is available." \
                  % path
            self.assertEqual(str(exc), msg)
        path = os.path.join(os.sep, 'xyzzy')
        ref = FileRef(path)
        try:
            ref.open()
        except ValueError, exc:
            msg = "Path '%s' is absolute and no path checker is available." \
                  % path
            self.assertEqual(str(exc), msg)
        else:
            self.fail('Expected ValueError')

        # Relative FileRef.
        path = 'xyzzy'
        ref = FileRef(path)
        try:
            ref.open()
        except ValueError, exc:
            msg = "Path '%s' is relative and no absolute directory is available." \
                  % path
            self.assertEqual(str(exc), msg)
        else:
            self.fail('Expected ValueError')

    def test_bad_trait(self):
        logging.debug('')
        logging.debug('test_bad_trait')

        try:
            File(42)
        except Exception, exc:
            self.assertEqual(str(exc),
Exemplo n.º 4
0
        path = os.path.join(os.sep, 'xyzzy')
        ref = FileRef(path)
        try:
            ref.open()
        except ValueError, exc:
            msg = "Path '%s' is absolute and no path checker is available." \
                  % path
            self.assertEqual(str(exc), msg)
        else:
            self.fail('Expected ValueError')

        # Relative FileRef.
        path = 'xyzzy'
        ref = FileRef(path)
        try:
            ref.open()
        except ValueError, exc:
            msg = "Path '%s' is relative and no absolute directory is available." \
                  % path
            self.assertEqual(str(exc), msg)
        else:
            self.fail('Expected ValueError')

    def test_bad_trait(self):
        logging.debug('')
        logging.debug('test_bad_trait')

        try:
            File(42)
        except Exception, exc:
            self.assertEqual(str(exc), 'File default value must be a FileRef.')