mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 15:32:38 -07:00
Bump cherrypy from 18.8.0 to 18.9.0 (#2266)
* Bump cherrypy from 18.8.0 to 18.9.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.8.0 to 18.9.0. - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.8.0...v18.9.0) --- updated-dependencies: - dependency-name: cherrypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cherrypy==18.9.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
cfefa928be
commit
faef9a94c4
673 changed files with 159850 additions and 11583 deletions
140
lib/win32com/test/testIterators.py
Normal file
140
lib/win32com/test/testIterators.py
Normal file
|
@ -0,0 +1,140 @@
|
|||
# Some raw iter tests. Some "high-level" iterator tests can be found in
|
||||
# testvb.py and testOutlook.py
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import pythoncom
|
||||
import win32com.server.util
|
||||
import win32com.test.util
|
||||
from win32com.client import Dispatch
|
||||
from win32com.client.gencache import EnsureDispatch
|
||||
|
||||
|
||||
class _BaseTestCase(win32com.test.util.TestCase):
|
||||
def test_enumvariant_vb(self):
|
||||
ob, iter = self.iter_factory()
|
||||
got = []
|
||||
for v in iter:
|
||||
got.append(v)
|
||||
self.assertEqual(got, self.expected_data)
|
||||
|
||||
def test_yield(self):
|
||||
ob, i = self.iter_factory()
|
||||
got = []
|
||||
for v in iter(i):
|
||||
got.append(v)
|
||||
self.assertEqual(got, self.expected_data)
|
||||
|
||||
def _do_test_nonenum(self, object):
|
||||
try:
|
||||
for i in object:
|
||||
pass
|
||||
self.fail("Could iterate over a non-iterable object")
|
||||
except TypeError:
|
||||
pass # this is expected.
|
||||
self.assertRaises(TypeError, iter, object)
|
||||
self.assertRaises(AttributeError, getattr, object, "next")
|
||||
|
||||
def test_nonenum_wrapper(self):
|
||||
# Check our raw PyIDispatch
|
||||
ob = self.object._oleobj_
|
||||
try:
|
||||
for i in ob:
|
||||
pass
|
||||
self.fail("Could iterate over a non-iterable object")
|
||||
except TypeError:
|
||||
pass # this is expected.
|
||||
self.assertRaises(TypeError, iter, ob)
|
||||
self.assertRaises(AttributeError, getattr, ob, "next")
|
||||
|
||||
# And our Dispatch wrapper
|
||||
ob = self.object
|
||||
try:
|
||||
for i in ob:
|
||||
pass
|
||||
self.fail("Could iterate over a non-iterable object")
|
||||
except TypeError:
|
||||
pass # this is expected.
|
||||
# Note that as our object may be dynamic, we *do* have a __getitem__
|
||||
# method, meaning we *can* call iter() on the object. In this case
|
||||
# actual iteration is what fails.
|
||||
# So either the 'iter(); will raise a type error, or an attempt to
|
||||
# fetch it
|
||||
try:
|
||||
next(iter(ob))
|
||||
self.fail("Expected a TypeError fetching this iterator")
|
||||
except TypeError:
|
||||
pass
|
||||
# And it should never have a 'next' method
|
||||
self.assertRaises(AttributeError, getattr, ob, "next")
|
||||
|
||||
|
||||
class VBTestCase(_BaseTestCase):
|
||||
def setUp(self):
|
||||
def factory():
|
||||
# Our VB test harness exposes a property with IEnumVariant.
|
||||
ob = self.object.EnumerableCollectionProperty
|
||||
for i in self.expected_data:
|
||||
ob.Add(i)
|
||||
# Get the raw IEnumVARIANT.
|
||||
invkind = pythoncom.DISPATCH_METHOD | pythoncom.DISPATCH_PROPERTYGET
|
||||
iter = ob._oleobj_.InvokeTypes(
|
||||
pythoncom.DISPID_NEWENUM, 0, invkind, (13, 10), ()
|
||||
)
|
||||
return ob, iter.QueryInterface(pythoncom.IID_IEnumVARIANT)
|
||||
|
||||
# We *need* generated dispatch semantics, so dynamic __getitem__ etc
|
||||
# don't get in the way of our tests.
|
||||
self.object = EnsureDispatch("PyCOMVBTest.Tester")
|
||||
self.expected_data = [1, "Two", "3"]
|
||||
self.iter_factory = factory
|
||||
|
||||
def tearDown(self):
|
||||
self.object = None
|
||||
|
||||
|
||||
# Test our client semantics, but using a wrapped Python list object.
|
||||
# This has the effect of re-using our client specific tests, but in this
|
||||
# case is exercising the server side.
|
||||
class SomeObject:
|
||||
_public_methods_ = ["GetCollection"]
|
||||
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
|
||||
def GetCollection(self):
|
||||
return win32com.server.util.NewCollection(self.data)
|
||||
|
||||
|
||||
class WrappedPythonCOMServerTestCase(_BaseTestCase):
|
||||
def setUp(self):
|
||||
def factory():
|
||||
ob = self.object.GetCollection()
|
||||
flags = pythoncom.DISPATCH_METHOD | pythoncom.DISPATCH_PROPERTYGET
|
||||
enum = ob._oleobj_.Invoke(pythoncom.DISPID_NEWENUM, 0, flags, 1)
|
||||
return ob, enum.QueryInterface(pythoncom.IID_IEnumVARIANT)
|
||||
|
||||
self.expected_data = [1, "Two", 3]
|
||||
sv = win32com.server.util.wrap(SomeObject(self.expected_data))
|
||||
self.object = Dispatch(sv)
|
||||
self.iter_factory = factory
|
||||
|
||||
def tearDown(self):
|
||||
self.object = None
|
||||
|
||||
|
||||
def suite():
|
||||
# We dont want our base class run
|
||||
suite = unittest.TestSuite()
|
||||
for item in list(globals().values()):
|
||||
if (
|
||||
type(item) == type(unittest.TestCase)
|
||||
and issubclass(item, unittest.TestCase)
|
||||
and item != _BaseTestCase
|
||||
):
|
||||
suite.addTest(unittest.makeSuite(item))
|
||||
return suite
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=sys.argv + ["suite"])
|
Loading…
Add table
Add a link
Reference in a new issue