GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — unittest.mock.seal doesn't work as expected with AsyncMock · Issue #100287 · python/cpython Closed Labels stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionI noticed this while reviewing #100252 (comment) I believe the following test case should pass, but it doesn't on main import unittest from unittest.mock import Mock, seal class AsyncClass: async def async_method(self): pass def normal_method(self): pass class Case(unittest.TestCase): def test_spec_normal_methods_on_class_with_mock_seal(self): mock = Mock(AsyncClass) seal(mock) # test passes, aka this raises AttributError with self.assertRaises(AttributeError): mock.normal_method # test fails, aka this does not raise AttributError with self.assertRaises(AttributeError): mock.async_method unittest.main() It's easy to fix, just need to move the clause that handles AsyncMock after the cc @sobolevn who moved the Linked PRsActivity
MetadataMetadataAssigneesLabelsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |