Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allowed sending of device address on all transport. Raising exce…
…ption if a transport requires address and non is given. Added typings to transports.py Fixes #9
- Loading branch information
Showing
4 changed files
with
90 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
from iec62056_21 import exceptions, client, transports | ||
|
||
|
||
class TestIec6205621Client: | ||
def test_with_no_address_when_required_raises_client_error(self): | ||
with pytest.raises(exceptions.Iec6205621ClientError): | ||
c = client.Iec6205621Client.with_tcp_transport(("192.168.1.1", 5000)) | ||
|
||
def test_can_create_client_with_tcp_transport(self): | ||
c = client.Iec6205621Client.with_tcp_transport( | ||
"192.168.1.1", device_address="00000000" | ||
) | ||
|
||
def test_no_address_when_required_raises_client_error(self): | ||
trans = transports.TcpTransport(address=("192.168.1.1", 5000)) | ||
with pytest.raises(exceptions.Iec6205621ClientError): | ||
c = client.Iec6205621Client(transport=trans) | ||
|
||
def test_can_create_client_tcp_transport(self): | ||
trans = transports.TcpTransport(address=("192.168.1.1", 5000)) | ||
c = client.Iec6205621Client(transport=trans, device_address="00000000") |