Skip to content

Commit 77a4b63

Browse files
authored
Fix cfg::memory tests that used simple scoping (#891)
1 parent e1e5ef3 commit 77a4b63

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

tests/test_datetime.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,20 @@ async def test_duration_02(self):
101101

102102
# Test encode
103103
durs_enc = self.client.query('''
104-
WITH args := array_unpack(
105-
<array<tuple<duration, duration, duration>>>$0)
106-
SELECT args.0 + args.1 = args.2;
104+
WITH
105+
args := array_unpack(
106+
<array<tuple<duration, duration, duration>>>$0
107+
)
108+
FOR a IN args UNION a.0 + a.1 = a.2;
107109
''', durs)
108110

109111
# Test decode
110112
durs_dec = self.client.query('''
111-
WITH args := array_unpack(
112-
<array<tuple<duration, duration, duration>>>$0)
113-
SELECT (args.0 + args.1, args.2);
113+
WITH
114+
args := array_unpack(
115+
<array<tuple<duration, duration, duration>>>$0
116+
)
117+
FOR a IN args UNION (a.0 + a.1, a.2);
114118
''', durs)
115119

116120
self.assertEqual(durs_enc, [True] * len(durs))

tests/test_memory.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,19 @@ async def test_config_memory_01(self):
4545
# Test that ConfigMemory.__str__ formats the
4646
# same as <str><cfg::memory>
4747
mem_tuples = self.client.query('''
48-
WITH args := array_unpack(<array<str>>$0)
49-
SELECT (
50-
<cfg::memory>args,
51-
<str><cfg::memory>args,
52-
<int64><cfg::memory>args
48+
FOR a IN array_unpack(<array<str>>$0) UNION
49+
(
50+
<cfg::memory>a,
51+
<str><cfg::memory>a,
52+
<int64><cfg::memory>a,
5353
);
5454
''', mem_strs)
5555

5656
mem_vals = [t[0] for t in mem_tuples]
5757

5858
# Test encode/decode roundtrip
5959
roundtrip = self.client.query('''
60-
WITH args := array_unpack(<array<cfg::memory>>$0)
61-
SELECT args;
60+
SELECT array_unpack(<array<cfg::memory>>$0);
6261
''', mem_vals)
6362

6463
self.assertEqual(

0 commit comments

Comments
 (0)