sql-testing-tools 0.2.9__py3-none-any.whl → 0.2.10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,34 +152,35 @@ def buildAndSendCosetteRequest(baseDict, sql, sol):
152
152
  def checkKeywords(startWord:str, endWords:list):
153
153
  global sql,sol
154
154
 
155
- if(startWord not in sol and startWord not in sql):
155
+ startWord = startWord.lower()
156
+
157
+ if(startWord not in sol.lower() and startWord not in sql.lower()):
156
158
  return ""
157
159
 
158
- if(startWord in sql):
159
- start = str.find(sql, startWord)
160
+ if(startWord in sql.lower()):
161
+ start = sql.lower().find(startWord) + len(startWord)
160
162
  end = -1
161
163
  for kw in endWords:
162
- if(str.find(sql, kw) != -1):
163
- end = str.find(sql, kw)
164
- break
164
+ index = sql.lower().find(kw.lower(), start)
165
+ if -1 < index < end or end == -1:
166
+ end = index
165
167
  if(end == -1):
166
168
  end = len(sql)
167
169
 
168
170
  submission = str.strip(sql[start:end])
169
171
  #print("'"+submission+"'")
170
172
 
171
- start = str.find(sol, startWord)
173
+ start = sol.lower().find(startWord) + len(startWord)
172
174
  end = -1
173
175
 
174
176
  for kw in endWords:
175
- if(str.find(sol, kw) != -1):
176
- end = str.find(sol, kw)
177
- break
177
+ index = sol.lower().find(kw.lower(), start)
178
+ if -1 < index < end or end == -1:
179
+ end = index
178
180
  if(end == -1):
179
181
  end = len(sol)
180
182
 
181
183
  solution = str.strip(sol[start:end])
182
- #print("'"+solution+"'")
183
184
 
184
185
  if submission == solution:
185
186
  return ""
@@ -189,31 +190,31 @@ def checkKeywords(startWord:str, endWords:list):
189
190
  def checkColumns(sqlPath="", solPath=""):
190
191
  global sql,sol
191
192
  setup(sqlPath, solPath)
192
- return checkKeywords("SELECT", ["FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
193
+ return checkKeywords("SELECT ", ["FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
193
194
 
194
195
 
195
196
  def checkTables(sqlPath="", solPath=""):
196
197
  global sql,sol
197
198
  setup(sqlPath, solPath)
198
- return checkKeywords("FROM", ["FROM", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
199
+ return checkKeywords("FROM ", ["SELECT", "WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
199
200
 
200
201
 
201
202
  def checkCondition(sqlPath="", solPath=""):
202
203
  global sql,sol
203
204
  setup(sqlPath, solPath)
204
- return checkKeywords("WHERE", ["GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
205
+ return checkKeywords("WHERE ", ["SELECT", "FROM", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
205
206
 
206
207
 
207
208
  def checkOrder(sqlPath="", solPath=""):
208
209
  global sql,sol
209
210
  setup(sqlPath, solPath)
210
- return checkKeywords("ORDER BY", ["WHERE", "GROUP BY", "ORDER BY", "LIMIT", ";", "HAVING"])
211
+ return checkKeywords("ORDER BY ", ["SELECT", "WHERE", "GROUP BY", "FROM", "LIMIT", ";", "HAVING"])
211
212
 
212
213
 
213
214
  def checkGroup(sqlPath="", solPath=""):
214
- global sql,sol
215
+ global sql, sol
215
216
  setup(sqlPath, solPath)
216
- return checkKeywords("GROUP BY", ["WHERE", "ORDER BY", "LIMIT", ";", "HAVING"])
217
+ return checkKeywords("GROUP BY ", ["SELECT", "WHERE", "FROM BY", "ORDER BY", "LIMIT", ";", "HAVING"])
217
218
 
218
219
 
219
220
  def checkEquality(sqlPath="", solPath=""):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: sql_testing_tools
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Description-Content-Type: text/markdown
5
5
  Requires-Dist: sqlparse>=0.5.1
6
6
  Requires-Dist: requests>=2.32.3
@@ -136,6 +136,9 @@ res = checkEquality()
136
136
 
137
137
  ### Changelog
138
138
 
139
+ ##### V 0.2.10
140
+ - fixed part checks if keywords are in wrong order
141
+
139
142
  ##### V 0.2.9
140
143
  - added NOT support
141
144
  - improved Parentheses handling
@@ -0,0 +1,8 @@
1
+ sql_testing_tools/BaseAccess.py,sha256=VcudaUKwhIF00UxZSYTQAN-6bK6K4Q1zrsSM6VoPF6o,6297
2
+ sql_testing_tools/Helper.py,sha256=rLqiPw3Ub7WYa6mM0mh7a1QF0fv9PhwLrl6OxBv8DLc,8453
3
+ sql_testing_tools/TokenProcessing.py,sha256=mfhDeB-8osAv8qnVoYFw01O112x3OKBaOIGrptuKR9E,14878
4
+ sql_testing_tools/__init__.py,sha256=eihMp9aizQd5Lnegu0y57WcyCinmy4Jvp66e0fiMPU4,49
5
+ sql_testing_tools-0.2.10.dist-info/METADATA,sha256=8k-yYVo-n496H-BcnFCzNAG61jrTkJucmAeKEGh2Mik,7353
6
+ sql_testing_tools-0.2.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
+ sql_testing_tools-0.2.10.dist-info/top_level.txt,sha256=qwEkmfJ_lYhIwcLXgfU75m0_JavVbOg96fN2zSatN3E,18
8
+ sql_testing_tools-0.2.10.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- sql_testing_tools/BaseAccess.py,sha256=VcudaUKwhIF00UxZSYTQAN-6bK6K4Q1zrsSM6VoPF6o,6297
2
- sql_testing_tools/Helper.py,sha256=C8yfKFNsAWvfGXc4jkeocVvLgtr9XCcOox8sb-yoMZw,8280
3
- sql_testing_tools/TokenProcessing.py,sha256=mfhDeB-8osAv8qnVoYFw01O112x3OKBaOIGrptuKR9E,14878
4
- sql_testing_tools/__init__.py,sha256=eihMp9aizQd5Lnegu0y57WcyCinmy4Jvp66e0fiMPU4,49
5
- sql_testing_tools-0.2.9.dist-info/METADATA,sha256=9YGnTqOlaTJRRWoW3EUG0x3GFt4XwuC3x7yn62hRubU,7285
6
- sql_testing_tools-0.2.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
7
- sql_testing_tools-0.2.9.dist-info/top_level.txt,sha256=qwEkmfJ_lYhIwcLXgfU75m0_JavVbOg96fN2zSatN3E,18
8
- sql_testing_tools-0.2.9.dist-info/RECORD,,