Commit 06879ab
authored
Add tests for COM connection point interfaces. (#919)
* test: Add `test/test_connectionpoints.py`.
This new test file, `test/test_connectionpoints.py`, verifies the functionality
of `connectionpoints` methods to ensure proper COM connection point management.
* test: Add `IConnectionPointContainer.EnumConnectionPoints` test.
Adds `test_EnumConnectionPoints` to `test_connectionpoints.py`. This test
verifies the correct enumeration of connection points and ensures that each
enumerated connection point properly returns its `IConnectionPointContainer`.
* test: Add `IConnectionPoint` interface tests.
This commit introduces `Test_IConnectionPoint` to `test_connectionpoints.py`.
It verifies the `IConnectionPoint.GetConnectionInterface` method, ensuring
that the correct interface ID is returned for a connection point.
* test: Add `IConnectionPoint.GetConnectionPointContainer` test.
This test verifies the `IConnectionPoint.GetConnectionPointContainer` method,
ensuring that the connection point correctly returns its owning
`IConnectionPointContainer`.
* test: Add `IConnectionPoint.Advise` and `IConnectionPoint.Unadvise` tests.
This commit adds `test_Advise_Unadvise` to `Test_IConnectionPoint` in
`test_connectionpoints.py`. It introduces a `Sink` class as a COM event
receiver and verifies the functionality of `IConnectionPoint.Advise` and
`IConnectionPoint.Unadvise` methods, ensuring proper connection and
disconnection of event sinks.
* test: Add `IConnectionPoint.EnumConnections` test.
This commit adds `test_EnumConnections` to the `Test_IConnectionPoint` class
in `test_connectionpoints.py`. This test verifies the correct enumeration of
active connections and ensures that the returned connection data (interface
pointer and cookie) matches the advised sink.
* refactor: Clarify assertions in `test_Advise_Unadvise`.
Adds comments to `test_Advise_Unadvise` in `test_connectionpoints.py` to
explicitly state the intent of each assertion regarding the connection status
before and after `Advise` and `Unadvise` calls.
* refactor: Encapsulate `Sink` creation within `Test_IConnectionPoint`.
Moves the `Sink` class definition into a `create_sink` class method within
`Test_IConnectionPoint` in `test_connectionpoints.py`. This change
encapsulates the `Sink` object creation logic.
* test: Add `Test_Sink` for `IConnectionPoint` event handling.
Introduces a new test class `Test_Sink` in `test_connectionpoints.py` to verify
proper event sinking mechanisms.
* refactor: Use `IUnknown` for sink return type in `create_sink_and_log`.
Adjusts the `create_sink_and_log` method in `test_connectionpoints.py` to
return the `IUnknown` interface. This change emphasizes that COM objects are
handled as pointers in the COM world, rather than being tied to specific Python
types or attributes.1 parent 338e34d commit 06879ab
1 file changed
Lines changed: 128 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
0 commit comments