Skip to content

Commit 2cdf624

Browse files
committed
Add test cases
1 parent b0139a0 commit 2cdf624

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

examples/joins/inner_join.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ group by c.name;
2323

2424
select a.goods_name, b.order_id, c.name from `data/goodses.json` a, `data/orders.json` b, `data/users.json` c
2525
where a.status=0 and b.goods_id=a.goods_id and b.status=0 and b.uid in (select uid from `data/users.json` where status=0)
26-
and c.uid=b.uid and c.status=0 and c.uid in (select uid from `data/users.json` where status=0);
26+
and c.uid=b.uid and c.status=0 and c.uid in (select uid from `data/users.json` where status=0);
27+
28+
select a.goods_name, b.order_id, c.name from `data/goodses.json` a, `data/orders.json` b, `data/users.json` c
29+
where a.status=0 and b.goods_id=a.goods_id and c.uid=b.uid;

tests/test_example_joins.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,10 @@ def test_inner_join(self):
119119
{'goods_name': '青菜', 'order_id': 5, 'name': '李四'},
120120
{'goods_name': '白菜', 'order_id': 3, 'name': '李四'},
121121
{'goods_name': '白菜', 'order_id': 6, 'name': '李四'}], "data error")
122+
123+
self.assert_data(28, [{'goods_name': '青菜', 'order_id': 1, 'name': '李四'},
124+
{'goods_name': '青菜', 'order_id': 2, 'name': '王五'},
125+
{'goods_name': '青菜', 'order_id': 4, 'name': '王五'},
126+
{'goods_name': '青菜', 'order_id': 5, 'name': '李四'},
127+
{'goods_name': '白菜', 'order_id': 3, 'name': '李四'},
128+
{'goods_name': '白菜', 'order_id': 6, 'name': '李四'}], "data error")

0 commit comments

Comments
 (0)