Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test to check setting a computed global using with_globals. #494

Merged
merged 1 commit into from
May 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading