Skip to content

Commit

Permalink
Data type converter: Remove methods for mutability
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Sep 27, 2022
1 parent 410c474 commit 299b771
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
7 changes: 0 additions & 7 deletions src/crate/client/converter.py
Expand Up @@ -112,13 +112,6 @@ def set(self, type_: Union[CrateDatatypeIdentifier, int], converter: Callable[[O
type_int = self.get_mapping_key(type_)
self.mappings[type_int] = converter

def remove(self, type_: Union[CrateDatatypeIdentifier, int]) -> None:
type_int = self.get_mapping_key(type_)
self.mappings.pop(type_int, None)

def update(self, mappings: Dict[int, Callable[[Optional[InputVal]], Optional[Any]]]) -> None:
self.mappings.update(mappings)

@staticmethod
def get_mapping_key(type_: Union[CrateDatatypeIdentifier, int]) -> int:
if isinstance(type_, Enum):
Expand Down
9 changes: 0 additions & 9 deletions src/crate/client/test_cursor.py
Expand Up @@ -93,15 +93,6 @@ def test_execute_with_converter(self):
],
])

# When removing the converters, all values are forwarded 1:1.
converter.remove(CrateDatatypeIdentifier.TEXT)
converter.remove(CrateDatatypeIdentifier.IP)
converter.remove(CrateDatatypeIdentifier.TIMESTAMP)
converter.remove(CrateDatatypeIdentifier.BIT)
c.execute("")
result = c.fetchone()
self.assertEqual(result, ['foo', '10.10.10.1', 1658167836758, "B'0110'"])

conn.close()

def test_execute_array_with_converter(self):
Expand Down

0 comments on commit 299b771

Please sign in to comment.