Skip to content

Commit

Permalink
#201 remove as_str (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj authored Feb 1, 2025
1 parent b69448d commit 2715b90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/senzing_grpc/szconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def add_data_source(
) -> str:
try:
request = szconfig_pb2.AddDataSourceRequest( # type: ignore[unused-ignore]
configHandle=config_handle, dataSourceCode=as_str(data_source_code)
configHandle=config_handle, dataSourceCode=data_source_code
)
response = self.stub.AddDataSource(request)
return str(response.result)
Expand All @@ -102,7 +102,7 @@ def create_config(self) -> int:

def delete_data_source(self, config_handle: int, data_source_code: str) -> None:
try:
request = szconfig_pb2.DeleteDataSourceRequest(configHandle=config_handle, dataSourceCode=as_str(data_source_code)) # type: ignore[unused-ignore]
request = szconfig_pb2.DeleteDataSourceRequest(configHandle=config_handle, dataSourceCode=data_source_code) # type: ignore[unused-ignore]
self.stub.DeleteDataSource(request)
except Exception as err:
raise new_exception(err) from err
Expand Down
6 changes: 3 additions & 3 deletions tests/szconfig_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import grpc
import pytest
from pytest_schema import Optional, Or, schema
from senzing import SzBadInputError, SzConfig, SzConfigurationError
from senzing import SzConfig, SzConfigurationError

from senzing_grpc import SzConfigGrpc

Expand Down Expand Up @@ -47,7 +47,7 @@ def test_add_data_source_bad_data_source_code_value(sz_config: SzConfig) -> None
config_handle = sz_config.create_config()
bad_data_source_code = {"XXXX": "YYYY"}
try:
with pytest.raises(SzBadInputError):
with pytest.raises(TypeError):
sz_config.add_data_source(config_handle, bad_data_source_code) # type: ignore[arg-type]
finally:
sz_config.close_config(config_handle)
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_delete_data_source_bad_data_source_code_value(sz_config: SzConfig) -> N
"""Test SzConfig().delete_data_source()."""
bad_data_source_code = {"XXXX": "YYYY"}
config_handle = sz_config.create_config()
with pytest.raises(SzBadInputError):
with pytest.raises(TypeError):
sz_config.delete_data_source(config_handle, bad_data_source_code) # type: ignore[arg-type]
sz_config.close_config(config_handle)

Expand Down

0 comments on commit 2715b90

Please sign in to comment.