當前位置: 首頁>>代碼示例>>Python>>正文


Python interfaces.IDifference類代碼示例

本文整理匯總了Python中Products.CMFDiffTool.interfaces.IDifference的典型用法代碼示例。如果您正苦於以下問題:Python IDifference類的具體用法?Python IDifference怎麽用?Python IDifference使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IDifference類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_should_diff

    def test_should_diff(self):
        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID,
            'obj1',
            title=u'Object 1',
            description=u'Desc 1',
            text=u'Text 1'
        )
        obj1 = self.portal['obj1']

        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID,
            'obj2',
            title=u'Object 2',
            text=u'Text 2'
        )
        obj2 = self.portal['obj2']

        diffs = DexterityCompoundDiff(obj1, obj2, 'any')
        for d in diffs:
            self.assertTrue(IDifference.providedBy(d))
            self.assertFalse(d.field in EXCLUDED_FIELDS)
            if d.field in ['title', 'description', 'text']:
                self.assertFalse(
                    d.same, 'Field %s should be different.' % d.field)
            else:
                self.assertTrue(d.same, 'Field %s should be equal.' % d.field)
開發者ID:syslabcom,項目名稱:Products.CMFDiffTool,代碼行數:27,代碼來源:test_dexteritydiff.py

示例2: test_inline_diff_same

    def test_inline_diff_same(self):
        value = RichTextValue(u'foo')
        diff = CMFDTHtmlDiff(DummyType(value), DummyType(value), 'body')
        inline_diff = diff.inline_diff()

        self.assertTrue(IDifference.providedBy(diff))
        self.assertEqual(diff.same, True)
        self.assertEqual(inline_diff, u'foo ')
開發者ID:jinankjain,項目名稱:Products.CMFDiffTool,代碼行數:8,代碼來源:test_richtextdiff.py

示例3: test_should_detect_same_data_and_filename

    def test_should_detect_same_data_and_filename(self):
        setRoles(self.portal, TEST_USER_ID, ["Manager"])
        self.portal.invokeFactory(TEST_CONTENT_TYPE_ID, "obj1", file=NamedFile(data="contents", filename=u"f.txt"))
        obj1 = self.portal["obj1"]

        self.portal.invokeFactory(TEST_CONTENT_TYPE_ID, "obj2", file=NamedFile(data="contents", filename=u"f.txt"))
        obj2 = self.portal["obj2"]

        diff = DexterityBinaryDiff(obj1, obj2, "file")
        self.assertTrue(IDifference.providedBy(diff))
        self.assertTrue(diff.same)
開發者ID:sixfeetup,項目名稱:collective.dexteritydiff,代碼行數:11,代碼來源:test_binarydiff.py

示例4: test_inline_diff_different

    def test_inline_diff_different(self):
        old_value = RichTextValue(u'foo')
        new_value = RichTextValue(u'foo bar')
        diff = CMFDTHtmlDiff(
            DummyType(old_value), DummyType(new_value), 'body')

        inline_diff = diff.inline_diff()

        self.assertTrue(IDifference.providedBy(diff))
        self.assertEqual(diff.same, False)
        self.assertEqual(inline_diff, u'foo <span class="insert">bar </span> ')
開發者ID:jinankjain,項目名稱:Products.CMFDiffTool,代碼行數:11,代碼來源:test_richtextdiff.py

示例5: _test_diff_bool

    def _test_diff_bool(self, b1, b2, same):
        diff = BoolDiff(DummyType(b1), DummyType(b2), 'bool_field')

        self.assertTrue(IDifference.providedBy(diff))
        self.assertEqual(diff.same, same)

        inline_diff = diff.inline_diff()
        if same:
            self.assertFalse(inline_diff)
        else:
            self.assertTrue(
                ('True' in inline_diff) or ('False' in inline_diff))
開發者ID:collective,項目名稱:collective.dexteritydiff,代碼行數:12,代碼來源:test_booldiff.py

示例6: _test_diff_date

    def _test_diff_date(self, d1, d2, same):
        diff = AsTextDiff(DateDummyType(d1), DateDummyType(d2), 'date')
        self.assertTrue(IDifference.providedBy(diff))
        self.assertEqual(diff.same, same)

        inline_diff = diff.inline_diff()
        if same:
            self.assertFalse(inline_diff)
        else:
            self.assertTrue(inline_diff)
            if d1 is not None:
                self.assertTrue(str(d1) in inline_diff)
            if d2 is not None:
                self.assertTrue(str(d2) in inline_diff)
開發者ID:CGTIC,項目名稱:Plone_SP,代碼行數:14,代碼來源:test_astextdiff.py

示例7: _test_diff_choice

    def _test_diff_choice(self, value1, value2, same):
        self.obj1.choice = value1
        self.obj2.choice = value2
        diff = ChoiceDiff(self.obj1, self.obj2, "choice")
        self.assertTrue(IDifference.providedBy(diff))
        self.assertEqual(diff.same, same)

        inline_diff = diff.inline_diff()
        if same:
            self.assertFalse(inline_diff)
        else:
            if value1 is not None:
                self.assertTrue(title_or_value(testing.VOCABULARY, value1) in inline_diff)
            if value2 is not None:
                self.assertTrue(title_or_value(testing.VOCABULARY, value2) in inline_diff)
開發者ID:pigaov10,項目名稱:plone4.3,代碼行數:15,代碼來源:test_choicediff.py

示例8: test_should_diff

    def test_should_diff(self):
        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID, "obj1", title=u"Object 1", description=u"Desc 1", text=u"Text 1"
        )
        obj1 = self.portal["obj1"]

        self.portal.invokeFactory(testing.TEST_CONTENT_TYPE_ID, "obj2", title=u"Object 2", text=u"Text 2")
        obj2 = self.portal["obj2"]

        diffs = DexterityCompoundDiff(obj1, obj2, "any")
        for d in diffs:
            self.assertTrue(IDifference.providedBy(d))
            self.assertFalse(d.field in EXCLUDED_FIELDS)
            if d.field in ["title", "description", "text"]:
                self.assertFalse(d.same, "Field %s should be different." % d.field)
            else:
                self.assertTrue(d.same, "Field %s should be equal." % d.field)
開發者ID:plone,項目名稱:Products.CMFDiffTool,代碼行數:17,代碼來源:test_dexteritydiff.py

示例9: test_should_detect_same_data_and_filename

    def test_should_detect_same_data_and_filename(self):
        self.loginAsPortalOwner()
        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID,
            'obj1',
            file=NamedFile(data='contents', filename=u'f.txt')
        )
        obj1 = self.portal['obj1']

        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID,
            'obj2',
            file=NamedFile(data='contents', filename=u'f.txt')
        )
        obj2 = self.portal['obj2']

        diff = namedfile.NamedFileBinaryDiff(obj1, obj2, 'file')
        self.assertTrue(IDifference.providedBy(diff))
        self.assertTrue(diff.same)
開發者ID:jinankjain,項目名稱:Products.CMFDiffTool,代碼行數:19,代碼來源:test_binarydiff.py

示例10: test_should_detect_same_data_and_filename

    def test_should_detect_same_data_and_filename(self):
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.portal.invokeFactory(
            TEST_CONTENT_TYPE_ID,
            'obj1',
            file=NamedFile(data='contents', filename=u'f.txt')
        )
        obj1 = self.portal['obj1']

        self.portal.invokeFactory(
            TEST_CONTENT_TYPE_ID,
            'obj2',
            file=NamedFile(data='contents', filename=u'f.txt')
        )
        obj2 = self.portal['obj2']

        diff = DexterityBinaryDiff(obj1, obj2, 'file')
        self.assertTrue(IDifference.providedBy(diff))
        self.assertTrue(diff.same)
開發者ID:collective,項目名稱:collective.dexteritydiff,代碼行數:19,代碼來源:test_binarydiff.py

示例11: test_should_detect_different_data

    def test_should_detect_different_data(self):
        setRoles(self.portal, TEST_USER_ID, ['Manager'])
        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID,
            'obj1',
            file=NamedFile(data='contents', filename=u'f.txt'),
        )
        obj1 = self.portal['obj1']

        self.portal.invokeFactory(
            testing.TEST_CONTENT_TYPE_ID,
            'obj2',
            file=NamedFile(data='different contents', filename=u'f.txt'),
        )
        obj2 = self.portal['obj2']

        diff = namedfile.NamedFileBinaryDiff(obj1, obj2, 'file')
        self.assertTrue(IDifference.providedBy(diff))
        self.assertFalse(diff.same)
開發者ID:plone,項目名稱:Products.CMFDiffTool,代碼行數:19,代碼來源:test_binarydiff.py

示例12: testInterface

    def testInterface(self):
        """Ensure that tool instances implement the portal_diff interface"""
        from Products.CMFDiffTool.interfaces import IDifference

        self.failUnless(IDifference.implementedBy(TextDiff))
開發者ID:pchanxxx,項目名稱:msc-buidout,代碼行數:5,代碼來源:testTextDiff.py

示例13: _test_diff_files

 def _test_diff_files(self, files1, files2, same):
     diff = DexterityFileListDiff(DummyType(files1), DummyType(files2), 'files')
     self.assertTrue(IDifference.providedBy(diff))
     self.assertEqual(diff.same, same)
     self.assertNotEqual(bool(diff.inline_diff()), same)
開發者ID:sixfeetup,項目名稱:collective.dexteritydiff,代碼行數:5,代碼來源:test_filelistdiff.py

示例14: testInterface

 def testInterface(self):
     """Ensure that tool instances implement the portal_diff interface"""
     self.assertTrue(IDifference.implementedBy(ListDiff))
開發者ID:plone,項目名稱:Products.CMFDiffTool,代碼行數:3,代碼來源:testListDiff.py


注:本文中的Products.CMFDiffTool.interfaces.IDifference類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。