Skip to content

Commit

Permalink
Add SafeCloseable test
Browse files Browse the repository at this point in the history
  • Loading branch information
arman-ddl committed Mar 15, 2024
1 parent c12ecf3 commit fbc4609
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion py/server/tests/test_jcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import unittest

from deephaven import dtypes
from deephaven.jcompat import j_function, j_lambda
from deephaven.jcompat import j_function, j_lambda, SafeCloseable
from tests.testbase import BaseTestCase

import jpy

_JSharedContext = jpy.get_type("io.deephaven.engine.table.SharedContext")

class JCompatTestCase(BaseTestCase):
def test_j_function(self):
Expand All @@ -29,6 +30,12 @@ def int_to_str(v: int) -> str:
r = j_func.apply(10)
self.assertEqual(r, "10")

def test_safe_closeable(self):
safe_closeable = SafeCloseable(_JSharedContext.makeSharedContext())
with safe_closeable:
pass
self.assertEqual(safe_closeable.closed, True)


if __name__ == "__main__":
unittest.main()

0 comments on commit fbc4609

Please sign in to comment.