Skip to content

Commit 4d00200

Browse files
committed
Give reasonable names to table fixtures instead of just numbering
1 parent 6756fe3 commit 4d00200

File tree

3 files changed

+111
-111
lines changed

3 files changed

+111
-111
lines changed

tests/conftest.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def _recreate(table_name, create_ddl):
7474

7575

7676
TEST1_CREATE_DDL = '''\
77-
CREATE TABLE test1
77+
CREATE TABLE test
7878
(
7979
id UInt64,
8080
enum Enum8(''=0, 'ONE'=1, 'TWO'=2),
@@ -88,11 +88,11 @@ async def _recreate(table_name, create_ddl):
8888

8989

9090
@pytest.fixture
91-
async def table_test1(recreate_table):
92-
await recreate_table('test1', TEST1_CREATE_DDL)
91+
async def table_test(recreate_table):
92+
await recreate_table('test', TEST1_CREATE_DDL)
9393

9494
return sa.Table(
95-
'test1', sa.MetaData(),
95+
'test', sa.MetaData(),
9696
sa.Column('id', sa.Integer),
9797
sa.Column('enum', sa.Enum, default=''),
9898
sa.Column('name', sa.String),
@@ -101,8 +101,8 @@ async def table_test1(recreate_table):
101101
)
102102

103103

104-
TEST2_CREATE_DDL = '''\
105-
CREATE TABLE test2
104+
TEST_MT_CREATE_DDL = '''\
105+
CREATE TABLE test_mt
106106
(
107107
title String,
108108
num UInt64
@@ -113,18 +113,18 @@ async def table_test1(recreate_table):
113113

114114

115115
@pytest.fixture
116-
async def table_test2(recreate_table):
117-
await recreate_table('test2', TEST2_CREATE_DDL)
116+
async def table_mt(recreate_table):
117+
await recreate_table('test_mt', TEST_MT_CREATE_DDL)
118118

119119
return sa.Table(
120-
'test2', sa.MetaData(),
121-
sa.Column('title', sa.String),
120+
'test_mt', sa.MetaData(),
122121
sa.Column('num', sa.Integer),
122+
sa.Column('title', sa.String),
123123
)
124124

125125

126-
TEST3_CREATE_DDL = '''\
127-
CREATE TABLE test3
126+
TEST_SMT_CREATE_DDL = '''\
127+
CREATE TABLE table_smt
128128
(
129129
key UInt8,
130130
value UInt64
@@ -135,18 +135,18 @@ async def table_test2(recreate_table):
135135

136136

137137
@pytest.fixture
138-
async def table_test3(recreate_table):
139-
await recreate_table('test3', TEST3_CREATE_DDL)
138+
async def table_smt(recreate_table):
139+
await recreate_table('table_smt', TEST_SMT_CREATE_DDL)
140140

141141
return sa.Table(
142-
'test3', sa.MetaData(),
142+
'table_smt', sa.MetaData(),
143143
sa.Column('key', sa.Integer),
144144
sa.Column('value', sa.Integer),
145145
)
146146

147147

148-
TEST4_CREATE_DDL = '''\
149-
CREATE TABLE test4
148+
TEST_AMT_CREATE_DDL = '''\
149+
CREATE TABLE test_amt
150150
(
151151
key UInt8,
152152
value AggregateFunction(sum, UInt8)
@@ -157,11 +157,11 @@ async def table_test3(recreate_table):
157157

158158

159159
@pytest.fixture
160-
async def table_test4(recreate_table):
161-
await recreate_table('test4', TEST4_CREATE_DDL)
160+
async def table_amt(recreate_table):
161+
await recreate_table('test_amt', TEST_AMT_CREATE_DDL)
162162

163163
return sa.Table(
164-
'test4', sa.MetaData(),
164+
'test_amt', sa.MetaData(),
165165
sa.Column('key', sa.Integer),
166166
sa.Column('value', sa.Integer),
167167
)

tests/test_exc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async def test_exc_stacktrace(dsn, statement):
3737
assert len(str(exc_info.value)) < len(exc_info.value.display_text) + 250
3838

3939

40-
async def test_exc_row(conn, table_test1):
40+
async def test_exc_row(conn, table_test):
4141
with pytest.raises(aiochsa.DBException) as exc_info:
4242
await conn.execute(
43-
table_test1.insert(),
43+
table_test.insert(),
4444
{'amount': Decimal('1234567890.1234567890')},
4545
)
4646
assert exc_info.value.code == error_codes.ARGUMENT_OUT_OF_BOUND

0 commit comments

Comments
 (0)