@@ -123,8 +123,14 @@ def testMakeQueryWithSubjectNot(self):
123123 }
124124 ]
125125 results = self .querybuilder ._makequery (query = query )
126- self .assertEqual (len (results ), 1 )
127- self .assertEqual (results [0 ].getURL (), "http://nohost/plone/testfolder" )
126+ # Since Products.ZCatalog 7.2.0 the Plone Site is also returned.
127+ # To keep the test compatible with both older and newer versions,
128+ # only assert that the page with subject 'Lorem' is not part of the
129+ # results (the presence of the Plone site itself may vary by ZCatalog
130+ # version).
131+ self .assertNotIn (
132+ self .testpage .absolute_url (), [brain .getURL () for brain in results ]
133+ )
128134
129135 def testMakeQueryWithMultipleSubject (self ):
130136 self .testpage .setSubject (["Lorem" ])
@@ -153,8 +159,14 @@ def testMakeQueryWithMultipleSubjectNot(self):
153159 }
154160 ]
155161 results = self .querybuilder ._makequery (query = query )
156- self .assertEqual (len (results ), 1 )
157- self .assertEqual (results [0 ].getURL (), "http://nohost/plone/testfolder" )
162+ # Since Products.ZCatalog 7.2.0 the Plone Site is also returned.
163+ # To keep the test compatible with both older and newer versions,
164+ # only assert that the page with subject 'Lorem' is not part of the
165+ # results (the presence of the Plone site itself may vary by ZCatalog
166+ # version).
167+ self .assertNotIn (
168+ self .testpage .absolute_url (), [brain .getURL () for brain in results ]
169+ )
158170
159171 def testMakeQueryWithSubjectWithSpecialCharacters (self ):
160172 self .testpage .setSubject (["Äüö" ])
0 commit comments