Skip to content

Commit

Permalink
Add test to check setting a computed global using with_globals. (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark authored May 24, 2024
1 parent e38833f commit 636bc0e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/test_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ async def test_globals_01(self):
CREATE GLOBAL def_glob -> str {
SET default := '!';
};
CREATE GLOBAL computed := '!';
CREATE MODULE foo;
CREATE MODULE foo::bar;
CREATE GLOBAL foo::bar::baz -> str;
Expand Down Expand Up @@ -64,6 +65,11 @@ async def test_globals_01(self):
x = await gdb.query_single('select global def_glob')
self.assertEqual(x, None)

# Setting computed global should produce error
async with db.with_globals(computed='test') as gdb:
with self.assertRaises(errors.QueryArgumentError):
await gdb.query_single('select global computed')

async with db.with_globals({'foo::bar::baz': 'asdf'}) as gdb:
x = await gdb.query_single('select global foo::bar::baz')
self.assertEqual(x, 'asdf')
Expand Down

0 comments on commit 636bc0e

Please sign in to comment.