Dataset Viewer
repo
stringclasses 8
values | instance_id
stringclasses 10
values | base_commit
stringclasses 10
values | patch
stringclasses 10
values | test_patch
stringclasses 10
values | problem_statement
stringclasses 10
values | hint_text
stringclasses 9
values | created_at
stringdate 2025-01-13 16:47:19
2025-06-13 09:27:11
| closed_at
stringdate 2025-01-13 16:47:19
2025-06-13 09:27:11
| version
stringclasses 2
values | FAIL_TO_PASS
listlengths 0
6
| PASS_TO_PASS
listlengths 14
248
| environment_setup_commit
stringclasses 1
value | command_build
stringclasses 1
value | command_test
stringclasses 1
value | image_name
stringclasses 1
value | meta
dict | timeout_build
int64 3k
3k
| timeout_test
int64 600
600
| command_test_small
stringclasses 10
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
reframe-hpc/reframe
|
reframe-hpc__reframe-3433
|
b7d86b1d777bc3bed7a3d71d95130376ab5d2820
|
diff --git a/reframe/utility/sanity.py b/reframe/utility/sanity.py
index a4f57a301..1228586ff 100644
--- a/reframe/utility/sanity.py
+++ b/reframe/utility/sanity.py
@@ -8,6 +8,7 @@
import contextlib
import glob as pyglob
import itertools
+import math
import os
import re
import sys
@@ -576,8 +577,14 @@ def calc_bound(thres):
return ref*(1 + thres)
- lower = calc_bound(lower_thres) or float('-inf')
- upper = calc_bound(upper_thres) or float('inf')
+ lower = calc_bound(lower_thres)
+ if lower is None:
+ lower = -math.inf
+
+ upper = calc_bound(upper_thres)
+ if upper is None:
+ upper = math.inf
+
try:
evaluate(assert_bounded(val, lower, upper))
except SanityError:
|
diff --git a/unittests/test_sanity_functions.py b/unittests/test_sanity_functions.py
index 7e6368938..0e9367027 100644
--- a/unittests/test_sanity_functions.py
+++ b/unittests/test_sanity_functions.py
@@ -473,6 +473,18 @@ def test_assert_reference():
r'\(l=-1\.2, u=-0\.9\)'):
sn.evaluate(sn.assert_reference(-0.8, -1, -0.2, 0.1))
+ # Check that bounds are correctly calculated in case that lower bound
+ # reaches zero (see also GH issue #3430)
+ with pytest.raises(SanityError,
+ match=r'1 is beyond reference value 0\.1 '
+ r'\(l=0\.0, u=0\.1\)'):
+ assert sn.assert_reference(1, 0.1, -1.0, 0)
+
+ with pytest.raises(SanityError,
+ match=r'-1 is beyond reference value -0\.1 '
+ r'\(l=-0\.1, u=-0\.0\)'):
+ assert sn.assert_reference(-1, -0.1, 0, 1.0)
+
# Check invalid thresholds
with pytest.raises(SanityError,
match=r'invalid high threshold value: -0\.1'):
|
Performance threshold goes to -inf when it should be zero.
In attempting to create a performance test where zero is the correct value, I created the following reference (since a value of zero results in no reference check being performed; see https://github.com/reframe-hpc/reframe/issues/2857):
```
self.reference = {
'*': {
'Gflops': (None, None, None, 'Gflops'),
'Exponent': (None, None, None, '10exp'),
'Time': (None, None, None, 'seconds'),
'failed_tests': (.1, -1.0, 0, 'tests'),
'skipped_tests': (.1, -1.0, 0, 'tests')
}}
```
I was thinking for the failed and skipped tests, this would create a lower bound of zero and upper bound of .1, allowing zero to pass, but integers larger than that would fail.
This works for me in that values of zero pass, and 1 or greater values fail, but what is unexpected is that the lower bound gets set to -inf:
```
* Reason: performance error: failed to meet references: skipped_tests=1 tests, expected 0.1 (l=-inf, u=0.1)
```
As an additional point of information when I set the lower bound values to -2.0 (or anything greater than 1 abs. value, to see what would happen), the following was printed:
```
invalid low threshold value: -2.0
invalid low threshold value: -2.0
```
But when I choose 2.0 as an upper bound, that seems to be fine:
```
'failed_tests': (.1, -1.0, 2.0, 'tests'),
'skipped_tests': (.1, -1.0, 2.0, 'tests')
```
results in the range being interpretted as follows:
```
* Reason: performance error: failed to meet references: skipped_tests=1 tests, expected 0.1 (l=-inf, u=0.30000000000000004)
```
It seems to me that the treatment of lower and upper threshold values should be consistent, and this does not seem consistent.
Although when I switch the reference value to a negative, that reverses the issue:
```
'failed_tests': (-1.0, 0, 2.0, 'tests'),
'skipped_tests': (-1.0, 0, 2.0, 'tests')
```
results in:
```
invalid high threshold value: 2.0
invalid high threshold value: 2.0
```
and to confirm, I set the lower threshold to -2.0 with a negative reference value to check:
```
'failed_tests': (-1.0, -2.0, 1.0, 'tests'),
'skipped_tests': (-1.0, -2.0, 1.0, 'tests')
```
results in:
```
PASSED
```
Meaning there was no error with the -2.0 reference value in this case. I am not sure what value the upper bound was getting set to in this case, since it wasn't printed out, but since there was no error, it must not be getting set to zero. If it matches the pattern, I am thinking it might be set to inf.
I am thinking there is something odd that happens when the threshold range crosses zero or has one end that is zero.
|
@vkarak: Related to #2857.@vkarak: > This works for me in that values of zero pass, and 1 or greater values fail, but what is unexpected is that the lower bound gets set to -inf:
Indeed this is a bug. These checks should check against `None`:
https://github.com/reframe-hpc/reframe/blob/b7d86b1d777bc3bed7a3d71d95130376ab5d2820/reframe/utility/sanity.py#L579-L580
As for the rest of the behaviour that you describe, this is documented: http://localhost:8000/deferrable_functions_reference.html#reframe.utility.sanity.assert_reference
The assumption made is that the extracted quantity is either positive or negative so the bounds should conform to this. That's why for example, you can't have a lower threshold > 1 for positive references, because this would imply a negative value for positive quantity.
|
2025-03-18T08:54:38Z
|
2025-03-18T08:54:38Z
|
0.3.88
|
[] |
[
"unittests/test_sanity_functions.py::test_assert_ge_with_deferrables",
"unittests/test_sanity_functions.py::test_assert_in",
"unittests/test_sanity_functions.py::test_count_uniq",
"unittests/test_sanity_functions.py::test_assert_false_with_deferrables",
"unittests/test_sanity_functions.py::test_assert_not_in",
"unittests/test_sanity_functions.py::test_assert_eq",
"unittests/test_sanity_functions.py::test_print_separator",
"unittests/test_sanity_functions.py::test_all",
"unittests/test_sanity_functions.py::test_extractall[extractall_s]",
"unittests/test_sanity_functions.py::test_assert_gt_with_deferrables",
"unittests/test_sanity_functions.py::test_assert_ne_with_deferrables",
"unittests/test_sanity_functions.py::test_hasattr",
"unittests/test_sanity_functions.py::test_chain",
"unittests/test_sanity_functions.py::test_assert_reference",
"unittests/test_sanity_functions.py::test_or",
"unittests/test_sanity_functions.py::test_print_stderr",
"unittests/test_sanity_functions.py::test_extractsingle[extractsingle_s]",
"unittests/test_sanity_functions.py::test_map",
"unittests/test_sanity_functions.py::test_abs",
"unittests/test_sanity_functions.py::test_extractall_encoding",
"unittests/test_sanity_functions.py::test_assert_not_in_with_deferrables",
"unittests/test_sanity_functions.py::test_path_isdir",
"unittests/test_sanity_functions.py::test_extractall_multiple_tags[extractall]",
"unittests/test_sanity_functions.py::test_assert_found_encoding",
"unittests/test_sanity_functions.py::test_any",
"unittests/test_sanity_functions.py::test_glob",
"unittests/test_sanity_functions.py::test_assert_found[assert_found_s]",
"unittests/test_sanity_functions.py::test_assert_in_with_deferrables",
"unittests/test_sanity_functions.py::test_allx",
"unittests/test_sanity_functions.py::test_assert_true_with_deferrables",
"unittests/test_sanity_functions.py::test_findall_encoding",
"unittests/test_sanity_functions.py::test_extractall_multiple_tags[extractall_s]",
"unittests/test_sanity_functions.py::test_extractsingle[extractsingle]",
"unittests/test_sanity_functions.py::test_avg",
"unittests/test_sanity_functions.py::test_extractsingle_encoding",
"unittests/test_sanity_functions.py::test_max",
"unittests/test_sanity_functions.py::test_findall_invalid_file",
"unittests/test_sanity_functions.py::test_extractall_invalid_file",
"unittests/test_sanity_functions.py::test_path_exists",
"unittests/test_sanity_functions.py::test_print_end",
"unittests/test_sanity_functions.py::test_round",
"unittests/test_sanity_functions.py::test_findall[findall_s]",
"unittests/test_sanity_functions.py::test_assert_le_with_deferrables",
"unittests/test_sanity_functions.py::test_assert_eq_with_deferrables",
"unittests/test_sanity_functions.py::test_sum",
"unittests/test_sanity_functions.py::test_assert_ne",
"unittests/test_sanity_functions.py::test_zip",
"unittests/test_sanity_functions.py::test_assert_gt",
"unittests/test_sanity_functions.py::test_assert_not_found[assert_not_found]",
"unittests/test_sanity_functions.py::test_reversed",
"unittests/test_sanity_functions.py::test_assert_not_found_encoding",
"unittests/test_sanity_functions.py::test_print_stdout",
"unittests/test_sanity_functions.py::test_enumerate",
"unittests/test_sanity_functions.py::test_assert_not_found[assert_not_found_s]",
"unittests/test_sanity_functions.py::test_extractall_error[extractall_s]",
"unittests/test_sanity_functions.py::test_len",
"unittests/test_sanity_functions.py::test_assert_lt_with_deferrables",
"unittests/test_sanity_functions.py::test_sorted",
"unittests/test_sanity_functions.py::test_extractall_custom_conv[extractall]",
"unittests/test_sanity_functions.py::test_assert_found[assert_found]",
"unittests/test_sanity_functions.py::test_findall[findall]",
"unittests/test_sanity_functions.py::test_getitem",
"unittests/test_sanity_functions.py::test_extractall[extractall]",
"unittests/test_sanity_functions.py::test_min",
"unittests/test_sanity_functions.py::test_assert_ge",
"unittests/test_sanity_functions.py::test_assert_lt",
"unittests/test_sanity_functions.py::test_extractall_error[extractall]",
"unittests/test_sanity_functions.py::test_assert_bounded",
"unittests/test_sanity_functions.py::test_getitem_with_deferrables",
"unittests/test_sanity_functions.py::test_count",
"unittests/test_sanity_functions.py::test_safe_format",
"unittests/test_sanity_functions.py::test_and",
"unittests/test_sanity_functions.py::test_extractall_custom_conv[extractall_s]",
"unittests/test_sanity_functions.py::test_iglob",
"unittests/test_sanity_functions.py::test_path_isfile",
"unittests/test_sanity_functions.py::test_setattr",
"unittests/test_sanity_functions.py::test_assert_le",
"unittests/test_sanity_functions.py::test_path_islink",
"unittests/test_sanity_functions.py::test_assert_true",
"unittests/test_sanity_functions.py::test_assert_false",
"unittests/test_sanity_functions.py::test_filter"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json unittests/test_sanity_functions.py",
"issue_number": 3430,
"merge_commit": "20fed5da1569a4962bed12510a89f53083aea3ef",
"merged_at": "",
"pr_number": 3433,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/reframe-hpc/reframe/pull/3433.diff",
"issue": "https://github.com/reframe-hpc/reframe/issues/3430",
"pr": "https://github.com/reframe-hpc/reframe/pull/3433"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json unittests/test_sanity_functions.py
|
|
tobymao/sqlglot
|
tobymao__sqlglot-4837
|
08eb7f2032957c2fe3119963f344538b90d8f631
|
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
index 24bf1492f7..f5ed3a8923 100644
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -1291,6 +1291,10 @@ class Parser(metaclass=_Parser):
"SIMPLE",
),
"INITIALLY": ("DEFERRED", "IMMEDIATE"),
+ "USING": (
+ "BTREE",
+ "HASH",
+ ),
**dict.fromkeys(("DEFERRABLE", "NORELY"), tuple()),
}
|
diff --git a/tests/dialects/test_mysql.py b/tests/dialects/test_mysql.py
index 06638f16c5..4a28176ccf 100644
--- a/tests/dialects/test_mysql.py
+++ b/tests/dialects/test_mysql.py
@@ -83,6 +83,12 @@ def test_ddl(self):
self.validate_identity(
"CREATE OR REPLACE VIEW my_view AS SELECT column1 AS `boo`, column2 AS `foo` FROM my_table WHERE column3 = 'some_value' UNION SELECT q.* FROM fruits_table, JSON_TABLE(Fruits, '$[*]' COLUMNS(id VARCHAR(255) PATH '$.$id', value VARCHAR(255) PATH '$.value')) AS q",
)
+ self.validate_identity(
+ "CREATE TABLE test_table (id INT AUTO_INCREMENT, PRIMARY KEY (id) USING BTREE)"
+ )
+ self.validate_identity(
+ "CREATE TABLE test_table (id INT AUTO_INCREMENT, PRIMARY KEY (id) USING HASH)"
+ )
self.validate_identity(
"/*left*/ EXPLAIN SELECT /*hint*/ col FROM t1 /*right*/",
"/* left */ DESCRIBE /* hint */ SELECT col FROM t1 /* right */",
|
MySQL dialect fails to parse PRIMARY KEY USING BTREE syntax
**Before you file an issue**
- Make sure you specify the "read" dialect eg. `parse_one(sql, read="spark")`
- Make sure you specify the "write" dialect eg. `ast.sql(dialect="duckdb")`
- Check if the issue still exists on main
yes, the issue still exists. I'v tried the latest version.
**Fully reproducible code snippet**
Please include a fully reproducible code snippet or the input sql, dialect, and expected output.
mysql:
`CREATE TABLE test_table (
id INT AUTO_INCREMENT,
alarm_category VARCHAR ( 255 ),
alarm_rule VARCHAR ( 255 ),
PRIMARY KEY(id) USING BTREE
)`
**Official Documentation**
Please include links to official SQL documentation related to your issue.
https://sqlglot.com/sqlglot.html#parse_one
|
@Gohoy: ```python
sql = "CREATE TABLE test_table ( id INT AUTO_INCREMENT, alarm_category VARCHAR ( 255 ), alarm_rule VARCHAR ( 255 ), PRIMARY KEY(id) USING BTREE )"
sqlglot.parse_one(sql,read='mysql')
# result
# sqlglot.errors.ParseError: Expecting ). Line 1, Col: 130.
# id INT AUTO_INCREMENT, alarm_category VARCHAR ( 255 ), alarm_rule VARCHAR ( 255 ), PRIMARY KEY(id) USING BTREE )
```
this is the reproducible python code
|
2025-03-05T15:49:35Z
|
2025-03-05T15:49:35Z
|
0.3.88
|
[] |
[
"tests/dialects/test_mysql.py::TestMySQL::test_show_like_or_where",
"tests/dialects/test_mysql.py::TestMySQL::test_identity",
"tests/dialects/test_mysql.py::TestMySQL::test_string_literals",
"tests/dialects/test_mysql.py::TestMySQL::test_show_columns",
"tests/dialects/test_mysql.py::TestMySQL::test_types",
"tests/dialects/test_mysql.py::TestMySQL::test_show_name",
"tests/dialects/test_mysql.py::TestMySQL::test_at_time_zone",
"tests/dialects/test_mysql.py::TestMySQL::test_convert",
"tests/dialects/test_mysql.py::TestMySQL::test_ddl",
"tests/dialects/test_mysql.py::TestMySQL::test_show_simple",
"tests/dialects/test_mysql.py::TestMySQL::test_show_processlist",
"tests/dialects/test_mysql.py::TestMySQL::test_match_against",
"tests/dialects/test_mysql.py::TestMySQL::test_number_format",
"tests/dialects/test_mysql.py::TestMySQL::test_show_db_like_or_where_sql",
"tests/dialects/test_mysql.py::TestMySQL::test_json_value",
"tests/dialects/test_mysql.py::TestMySQL::test_grant",
"tests/dialects/test_mysql.py::TestMySQL::test_date_format",
"tests/dialects/test_mysql.py::TestMySQL::test_timestamp_trunc",
"tests/dialects/test_mysql.py::TestMySQL::test_show_profile",
"tests/dialects/test_mysql.py::TestMySQL::test_show_grants",
"tests/dialects/test_mysql.py::TestMySQL::test_mysql",
"tests/dialects/test_mysql.py::TestMySQL::test_show_index",
"tests/dialects/test_mysql.py::TestMySQL::test_bits_literal",
"tests/dialects/test_mysql.py::TestMySQL::test_hexadecimal_literal",
"tests/dialects/test_mysql.py::TestMySQL::test_mysql_time",
"tests/dialects/test_mysql.py::TestMySQL::test_mysql_time_python311",
"tests/dialects/test_mysql.py::TestMySQL::test_canonical_functions",
"tests/dialects/test_mysql.py::TestMySQL::test_show_engine",
"tests/dialects/test_mysql.py::TestMySQL::test_analyze",
"tests/dialects/test_mysql.py::TestMySQL::test_show_events",
"tests/dialects/test_mysql.py::TestMySQL::test_is_null",
"tests/dialects/test_mysql.py::TestMySQL::test_show_tables",
"tests/dialects/test_mysql.py::TestMySQL::test_json_object",
"tests/dialects/test_mysql.py::TestMySQL::test_monthname",
"tests/dialects/test_mysql.py::TestMySQL::test_explain",
"tests/dialects/test_mysql.py::TestMySQL::test_set_variable",
"tests/dialects/test_mysql.py::TestMySQL::test_show_replica_status",
"tests/dialects/test_mysql.py::TestMySQL::test_show_errors",
"tests/dialects/test_mysql.py::TestMySQL::test_introducers",
"tests/dialects/test_mysql.py::TestMySQL::test_escape",
"tests/dialects/test_mysql.py::TestMySQL::test_safe_div"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json tests/dialects/test_mysql.py",
"issue_number": 4833,
"merge_commit": "adf2fef27dc341508c3b9c710da0f835277094a1",
"merged_at": "",
"pr_number": 4837,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/tobymao/sqlglot/pull/4837.diff",
"issue": "https://github.com/tobymao/sqlglot/issues/4833",
"pr": "https://github.com/tobymao/sqlglot/pull/4837"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json tests/dialects/test_mysql.py
|
|
matchms/matchms
|
matchms__matchms-809
|
0b1707bd866f56404e4056df678af12a4bc20141
|
diff --git a/matchms/importing/load_from_msp.py b/matchms/importing/load_from_msp.py
index cf7726a4..47dbedcc 100644
--- a/matchms/importing/load_from_msp.py
+++ b/matchms/importing/load_from_msp.py
@@ -109,7 +109,7 @@ def _parse_line_with_peaks(rline: str) -> Tuple[List[float], List[float], str]:
def get_peak_values(peak: str) -> Tuple[List[float], List[float]]:
"""Get the m/z and intensity value from the line containing the peak information."""
- tokens = re.findall(r"(\d+(?:\.\d+)?(?:e[-+]?\d+)?)", peak)
+ tokens = re.findall(r"(\d+(?:\.\d+)?(?:[eE][-+]?\d+)?)", peak)
if len(tokens) % 2 != 0:
raise RuntimeError("Wrong peak format detected!")
|
diff --git a/tests/importing/test_load_from_msp.py b/tests/importing/test_load_from_msp.py
index 891ac002..839b604c 100644
--- a/tests/importing/test_load_from_msp.py
+++ b/tests/importing/test_load_from_msp.py
@@ -2,7 +2,7 @@ import os
import numpy as np
import pytest
from matchms import Spectrum
-from matchms.importing.load_from_msp import load_from_msp, parse_metadata
+from matchms.importing.load_from_msp import get_peak_values, load_from_msp, parse_metadata
from tests.builder_Spectrum import SpectrumBuilder
@@ -285,3 +285,13 @@ def test_parse_metadata(input_line, expected_output):
params = {}
parse_metadata(input_line, params)
assert params == expected_output
+
+
+@pytest.mark.parametrize("line, expected", [
+ ["496 7.1E-05", ([496.0], [7.1E-05])],
+ ["496 7.1e-05", ([496.0], [7.1e-05])],
+ ["85:201 86:55 87:10 88:4 89:315", ([85.0, 86.0, 87.0, 88.0, 89.0], [201.0, 55.0, 10.0, 4.0, 315.0])],
+])
+def test_get_peak_values(line, expected):
+ actual = get_peak_values(line)
+ assert actual == expected
\ No newline at end of file
|
matchms fails when reading spectra where abundance is in scientific notation
Example spectrum - spotted in the MSDial EI RI library.
Funny thing is our regex only handles lower case `e` notation while this uses upper case.
Makes me think if we shouldn't just leave the parsing of stuff to python and try to just identify the tokens based on separator?
``` tokens = re.findall(r"(\d+(?:\.\d+)?(?:e[-+]?\d+)?)", peak)```
```
NAME: C10 FAME
EXACTMASS: 186.16198
FORMULA: C11H22O2
ONTOLOGY: Fatty acid methyl esters
INCHIKEY: YRHYCMZPEVDGFQ-UHFFFAOYSA-N
SMILES: CCCCCCCCCC(=O)OC
RETENTIONINDEX: 1325
IONMODE: Positive
INSTRUMENTTYPE: GC-EI-TOF
COMMENT: DB#=FiehnLibVolatile0005; origin=Volatile Fiehn Library for Metabolic Profiling
Num Peaks: 169
30 0.629467
31 1.545269
33 0.272632
36 0.02421
37 0.313882
38 0.539016
39 17.716311
40 1.915948
41 35.4716
42 9.51272
43 36.860957
44 0.788644
45 2.384747
46 0.104509
47 0.031949
48 0.035996
49 0.052609
50 0.529644
51 0.838982
52 0.365568
53 2.854753
54 1.750452
55 29.439195
56 4.268605
57 8.867918
58 0.591554
59 19.854767
60 0.49308
61 0.379342
62 0.260846
63 0.557191
64 0.08541
65 0.63394
66 0.192617
67 2.198946
68 1.443245
69 7.300356
70 1.714883
71 2.948257
72 0.322756
73 1.743069
74 100
75 9.275516
76 0.745407
77 0.361379
78 0.038481
79 0.615978
80 0.123323
81 1.452119
82 0.612854
83 3.739813
84 2.643535
85 1.788933
86 0.278383
87 44.905938
88 3.900623
89 0.580976
90 0.037416
91 0.023074
92 0.025701
93 0.21129
94 0.043806
95 0.774303
96 0.156408
97 2.040479
98 1.468662
99 0.256302
100 0.217679
101 5.157853
102 0.416331
103 0.024423
107 0.071992
108 0.018459
109 0.002485
110 0.228329
111 0.387719
112 0.390062
113 0.245724
114 0.05765
115 2.589718
116 0.396239
120 0.001136
121 0.032375
122 0.007242
123 0.027831
124 0.013561
125 0.150728
126 0.114094
127 0.07966
129 2.578359
130 0.256231
132 0.005254
135 0.102876
136 0.03486
137 0.071424
138 0.021157
139 0.314024
140 0.065886
141 2.280949
142 2.305443
143 7.497659
144 0.656233
145 0.026056
148 0.005112
152 0.034576
153 0.069223
154 0.035073
155 2.668384
156 0.291446
157 1.242179
158 0.131985
161 0.008875
163 0.018956
167 0.000213
169 0.00923
170 0.000142
171 0.011928
172 0.001704
174 0.002556
175 0.000781
182 0.003053
184 0.000284
185 0.008023
186 0.458362
187 0.050195
188 0.004189
191 0.000142
192 0.000781
195 0.000426
203 0.000284
209 0.00355
212 0.000284
214 0.000497
219 0.000213
231 0.000142
233 0.000142
234 0.000781
246 7.1E-05
249 0.00284
250 0.00142
251 0.000355
257 0.000639
263 0.000639
266 0.000213
270 0.000142
283 0.000284
295 0.000568
297 0.000355
314 0.000213
315 0.000142
321 0.000426
327 0.001207
329 0.000994
342 0.001633
348 0.000355
380 0.000142
390 0.000497
398 0.000213
401 0.006674
402 0.001775
403 0.000923
427 0.00071
455 0.000213
468 0.000355
474 0.00071
495 0.000213
496 7.1E-05
497 0.000355
500 0.000497
```
|
2025-06-13T09:27:11Z
|
2025-06-13T09:27:11Z
|
0.4.3
|
[] |
[
"tests/importing/test_load_from_msp.py::test_load_from_msp_diverse_spectrum_collection",
"tests/importing/test_load_from_msp.py::test_load_from_msp_spaces_massbank_1",
"tests/importing/test_load_from_msp.py::test_parse_metadata[comments: SMILES=\"CC(O)C(O)=O\"-expected_output1]",
"tests/importing/test_load_from_msp.py::test_load_msp_with_scientific_notation",
"tests/importing/test_load_from_msp.py::test_get_peak_values[496\\t7.1e-05-expected1]",
"tests/importing/test_load_from_msp.py::test_parse_metadata[comments: mass=12.0-expected_output2]",
"tests/importing/test_load_from_msp.py::test_parse_metadata[name: 3,4-DICHLOROPHENOL-expected_output3]",
"tests/importing/test_load_from_msp.py::test_get_peak_values[85:201 86:55 87:10 88:4 89:315-expected2]",
"tests/importing/test_load_from_msp.py::test_load_from_msp_multiline",
"tests/importing/test_load_from_msp.py::test_load_from_msp_spaces_mona_1",
"tests/importing/test_load_from_msp.py::test_load_from_msp_spaces_mona_2",
"tests/importing/test_load_from_msp.py::test_load_golm_style_msp",
"tests/importing/test_load_from_msp.py::test_parse_metadata[comments: \"DB#=JP000001\"-expected_output5]",
"tests/importing/test_load_from_msp.py::test_load_msl",
"tests/importing/test_load_from_msp.py::test_load_msp_with_comments_including_quotes",
"tests/importing/test_load_from_msp.py::test_parse_metadata[comments: \"SMILES=\"-expected_output0]",
"tests/importing/test_load_from_msp.py::test_load_from_msp_tabs",
"tests/importing/test_load_from_msp.py::test_get_peak_values[496\\t7.1E-05-expected0]",
"tests/importing/test_load_from_msp.py::test_parse_metadata[comments: \"SMILES=CC(O)C(O)=O\"-expected_output4]"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json tests/importing/test_load_from_msp.py",
"issue_number": 802,
"merge_commit": "f54285408f4f6e702545871c126161120106e076",
"merged_at": "",
"pr_number": 809,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/matchms/matchms/pull/809.diff",
"issue": "https://github.com/matchms/matchms/issues/802",
"pr": "https://github.com/matchms/matchms/pull/809"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json tests/importing/test_load_from_msp.py
|
||
DataDog/guarddog
|
DataDog__guarddog-523
|
4d8b7972885ce111991af01610b24b326dcc1de8
|
diff --git a/guarddog/analyzer/metadata/bundled_binary.py b/guarddog/analyzer/metadata/bundled_binary.py
index 5b6e875..81ed040 100644
--- a/guarddog/analyzer/metadata/bundled_binary.py
+++ b/guarddog/analyzer/metadata/bundled_binary.py
@@ -14,7 +14,12 @@ class BundledBinary(Detector):
# magic bytes are the first few bytes of a file that can be used to identify the file type
# regardless of their extension
- magic_bytes = {"exe": b"\x4D\x5A", "elf": b"\x7F\x45\x4C\x46"}
+ magic_bytes = {
+ "exe": b"\x4D\x5A",
+ "elf": b"\x7F\x45\x4C\x46",
+ "macho32": b"\xFE\xED\xFA\xCE",
+ "macho64": b"\xFE\xED\xFA\xCF",
+ }
def __init__(self):
super().__init__(
|
diff --git a/tests/analyzer/metadata/test_bundled_binary.py b/tests/analyzer/metadata/test_bundled_binary.py
index 07f1845..7a01283 100644
--- a/tests/analyzer/metadata/test_bundled_binary.py
+++ b/tests/analyzer/metadata/test_bundled_binary.py
@@ -19,6 +19,8 @@ class TestBundleBinary:
binary_sample_elf = (
b"\x7F\x45\x4C\x46" + b"0x90" * 10
) # elf magic number plus nop sled
+ binary_sample_macho32 = b"\xFE\xED\xFA\xCE" + b"0x90" * 10
+ binary_sample_macho64 = b"\xFE\xED\xFA\xCF" + b"0x90" * 10
@pytest.mark.parametrize(
"detector",
@@ -52,6 +54,38 @@ class TestBundleBinary:
matches, _ = detector.detect({}, dir)
assert matches
+ @pytest.mark.parametrize(
+ "detector",
+ [
+ (pypi_detector),
+ (npm_detector),
+ ],
+ )
+ def test_macho32(self, detector: BundledBinary):
+ with tempfile.TemporaryDirectory() as dir:
+ full_path = os.path.join(dir, "package")
+ os.mkdir(full_path)
+ with open(os.path.join(full_path, "linux.txt"), "wb") as f:
+ f.write(self.binary_sample_macho32)
+ matches, _ = detector.detect({}, dir)
+ assert matches
+
+ @pytest.mark.parametrize(
+ "detector",
+ [
+ (pypi_detector),
+ (npm_detector),
+ ],
+ )
+ def test_macho64(self, detector: BundledBinary):
+ with tempfile.TemporaryDirectory() as dir:
+ full_path = os.path.join(dir, "package")
+ os.mkdir(full_path)
+ with open(os.path.join(full_path, "linux.txt"), "wb") as f:
+ f.write(self.binary_sample_macho64)
+ matches, _ = detector.detect({}, dir)
+ assert matches
+
@pytest.mark.parametrize(
"detector",
[
|
Add Mach-O magic bytes to the bundled binary detector
The [bundled binary detector](https://github.com/DataDog/guarddog/blob/v2.1.0/guarddog/analyzer/metadata/bundled_binary.py#L17) currently detects **ELF** (Unix) and **exe** (Windows) files, but it does not account for the magic bytes for **Mach-O** (Mac) files. This could lead to malicious packages targeting Macs to go unnoticed.
For reference:

See https://en.wikipedia.org/wiki/Mach-O#Mach-O_header for more info.
|
@ocku: Let me know if I can work on this :)@sobregosodd: Hello @ocku , the case you point out seems valid as well
Please, send the PR well look into it.
Thanks again!@ocku: ^ Created. Sorry for the delay! I had some issues with GitHub.
|
2025-01-22T12:07:10Z
|
2025-01-22T12:07:10Z
|
0.4.3
|
[] |
[
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_plain[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_empty[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_macho64[detector0]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_empty[detector0]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_macho64[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_exe[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_macho32[detector0]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_exe[detector0]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_plain[detector0]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_elf[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_macho32[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_multiplebinaries[detector0]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_multiplebinaries[detector1]",
"tests/analyzer/metadata/test_bundled_binary.py::TestBundleBinary::test_elf[detector0]"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json tests/analyzer/metadata/test_bundled_binary.py",
"issue_number": 498,
"merge_commit": "4ddb8c8b437c070dc86f17824b7690b5cd4385fe",
"merged_at": "",
"pr_number": 523,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/DataDog/guarddog/pull/523.diff",
"issue": "https://github.com/DataDog/guarddog/issues/498",
"pr": "https://github.com/DataDog/guarddog/pull/523"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json tests/analyzer/metadata/test_bundled_binary.py
|
|
mitmproxy/pdoc
|
mitmproxy__pdoc-806
|
ea2b69a4162226b07f68cd25d92d4d92dbbafaf8
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 747d22f..3337d33 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,8 @@
## Unreleased: pdoc next
+- Include included HTML headers in the ToC by default by enabling markdown2's `mixed=True` option of the `header-ids` extra
+ (#806, @mrossinek)
## 2025-04-21: pdoc 15.0.3
diff --git a/pdoc/render_helpers.py b/pdoc/render_helpers.py
index 5c1f339..c96194b 100644
--- a/pdoc/render_helpers.py
+++ b/pdoc/render_helpers.py
@@ -61,7 +61,7 @@ markdown_extensions = {
"cuddled-lists": None,
"fenced-code-blocks": {"cssclass": formatter.cssclass},
"footnotes": None,
- "header-ids": None,
+ "header-ids": {"mixed": True, "prefix": None, "reset-count": True},
"link-patterns": None,
"markdown-in-html": None,
"mermaid": None,
|
diff --git a/test/test_render_helpers.py b/test/test_render_helpers.py
index c17740f..4279725 100644
--- a/test/test_render_helpers.py
+++ b/test/test_render_helpers.py
@@ -110,6 +110,22 @@ def test_markdown_toc():
assert to_html("#foo\n#bar").toc_html # type: ignore
+def test_mixed_toc():
+ """
+ markdown2 can handle mixed markdown and HTML headings.
+
+ Let's test that this works as expected.
+ """
+ expected = [
+ "<ul>",
+ ' <li><a href="#foo">foo</a></li>',
+ ' <li><a href="#bar">bar</a></li>',
+ "</ul>",
+ "",
+ ]
+ assert to_html("#foo\n<h1>bar</h1>").toc_html == "\n".join(expected)
+
+
@pytest.mark.parametrize(
"md,html",
[
|
Include HTML headers in ToC
#### Problem Description
When a docstring includes HTML headers (`<h1>`, etc.) for example when I used an `.. include:: some_file.html` (or some markdown file which mixes markdown and HTML headers for some reason) directive, those headers are not included in the table of contents.
#### Proposal
markdown2 already supports this feature: https://github.com/trentm/python-markdown2/pull/538.
All one would need to do, is set `header-ids["mixed"] = True` for the header-ids extra, which pdoc already uses.
#### Additional Context
Essentially, I would consider this the reverse of the `markdown-in-html` setting, which is already supported by pdoc. So I do not see a reason not to support this.
|
@mhils: Sure, please send a PR!@mrossinek: > Sure, please send a PR!
Happy to do so! How should I approach this?
1. Should I simply enable mixed header-ids by default? E.g. through `"header-ids": {"mixed": True}` here: https://github.com/mitmproxy/pdoc/blob/ea2b69a4162226b07f68cd25d92d4d92dbbafaf8/pdoc/render_helpers.py#L64
2. Or should I add a new command-line argument, e.g. `--mixed-header-ids` which indicates this boolean value? One could leave its default to be `False`, therefore not changing the current behavior.@mhils: Definitely 1), we want to keep the CLI surface as small as possible.
|
2025-05-04T12:43:09Z
|
2025-05-04T12:43:09Z
|
0.4.3
|
[] |
[
"test/test_render_helpers.py::test_markdown_autolink[See https://www.python.org.-<p>See <a href=\"https://www.python.org\">https://www.python.org</a>.</p>\\n]",
"test/test_render_helpers.py::test_qualname_candidates[foo-candidates1]",
"test/test_render_helpers.py::test_relative_link[foo.bar-foo.bar.baz-bar/baz.html]",
"test/test_render_helpers.py::test_markdown_autolink[https://example.com/-<p><a href=\"https://example.com/\">https://example.com/</a></p>\\n]",
"test/test_render_helpers.py::test_edit_url[demo-True-mapping2-https://github.com/mhils/pdoc/blob/master/test/testdata/demo/__init__.py]",
"test/test_render_helpers.py::test_edit_url[demo-False-mapping0-None]",
"test/test_render_helpers.py::test_split_identifier[all_modules1-a.c.b.d-result1]",
"test/test_render_helpers.py::test_possible_sources[all_modules1-a.b-result1]",
"test/test_render_helpers.py::test_relative_link[foo.foo-foo-../foo.html]",
"test/test_render_helpers.py::test_relative_link[foo.bar.baz-foo.qux.quux-../qux/quux.html]",
"test/test_render_helpers.py::test_markdown_toc",
"test/test_render_helpers.py::test_relative_link[foo-bar-bar.html]",
"test/test_render_helpers.py::test_module_candidates[foo.bar.baz-foo-candidates2]",
"test/test_render_helpers.py::test_qualname_candidates[-candidates0]",
"test/test_render_helpers.py::test_split_identifier[all_modules0-a.b.c.d-result0]",
"test/test_render_helpers.py::test_possible_sources[all_modules0-a.B-result0]",
"test/test_render_helpers.py::test_markdown_autolink[See **https://www.python.org**.-<p>See <strong>https://www.python.org</strong>.</p>\\n]",
"test/test_render_helpers.py::test_possible_sources[all_modules3-a.b.c.d-result3]",
"test/test_render_helpers.py::test_markdown_autolink[See the [Python home page ](https://www.python.org) for info.-<p>See the <a href=\"https://www.python.org\">Python home page </a> for info.</p>\\n]",
"test/test_render_helpers.py::test_qualname_candidates[foo.bar-candidates2]",
"test/test_render_helpers.py::test_markdown_autolink[<a href=\"https://example.com\">link</a>-<p><a href=\"https://example.com\">link</a></p>\\n]",
"test/test_render_helpers.py::test_module_candidates[foo.bar.baz-qux-candidates0]",
"test/test_render_helpers.py::test_markdown_autolink[<https://example.com>-<p><a href=\"https://example.com\">https://example.com</a></p>\\n]",
"test/test_render_helpers.py::test_edit_url[demo-False-mapping1-https://github.com/mhils/pdoc/blob/master/test/testdata/demo.py]",
"test/test_render_helpers.py::test_markdown_autolink[[link](https://example.com)-<p><a href=\"https://example.com\">link</a></p>\\n]",
"test/test_render_helpers.py::test_mixed_toc",
"test/test_render_helpers.py::test_module_candidates[foo.bar.baz-foo.bar-candidates1]",
"test/test_render_helpers.py::test_relative_link[foo-foo-]",
"test/test_render_helpers.py::test_possible_sources[all_modules2-a-result2]",
"test/test_render_helpers.py::test_relative_link[foo.foo-bar-../bar.html]"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json test/test_render_helpers.py",
"issue_number": 805,
"merge_commit": "2ab4df12693678439a9063f0e3909c26545241a9",
"merged_at": "",
"pr_number": 806,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/mitmproxy/pdoc/pull/806.diff",
"issue": "https://github.com/mitmproxy/pdoc/issues/805",
"pr": "https://github.com/mitmproxy/pdoc/pull/806"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json test/test_render_helpers.py
|
|
tobymao/sqlglot
|
tobymao__sqlglot-4618
|
cfa25bb59b4537427aebe93f92c7176e045e7b0c
|
diff --git a/sqlglot/parser.py b/sqlglot/parser.py
index 7f310b3b58..ae3f6cde66 100644
--- a/sqlglot/parser.py
+++ b/sqlglot/parser.py
@@ -5902,7 +5902,7 @@ def _parse_foreign_key(self) -> exp.ForeignKey:
)
def _parse_primary_key_part(self) -> t.Optional[exp.Expression]:
- return self._parse_field()
+ return self._parse_ordered() or self._parse_field()
def _parse_period_for_system_time(self) -> t.Optional[exp.PeriodForSystemTimeConstraint]:
if not self._match(TokenType.TIMESTAMP_SNAPSHOT):
|
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index 738120a2ee..fe1aa9c5dd 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -436,6 +436,13 @@ def test_tsql(self):
"'a' + 'b'",
)
+ self.validate_identity(
+ "CREATE TABLE db.t1 (a INTEGER, b VARCHAR(50), CONSTRAINT c PRIMARY KEY (a DESC))",
+ )
+ self.validate_identity(
+ "CREATE TABLE db.t1 (a INTEGER, b INTEGER, CONSTRAINT c PRIMARY KEY (a DESC, b))"
+ )
+
def test_option(self):
possible_options = [
"HASH GROUP",
|
TSQL: PRIMARY KEY constraint fails to parse if sort option is given
The following CREATE TABLE statement parses just fine:
```
import sqlglot
test = """CREATE TABLE dbo.test (
id INT,
name VARCHAR(50),
CONSTRAINT pk_testTable PRIMARY KEY (id)
) ;"""
parsed_script = sqlglot.parse(test, read="tsql")
```
However, when I add ASC or DESC to the PRIMARY KEY constraint, it fails to parse:
```
import sqlglot
test = """CREATE TABLE dbo.test (
id INT,
name VARCHAR(50),
CONSTRAINT pk_testTable PRIMARY KEY (id DESC)
) ;"""
parsed_script = sqlglot.parse(test, read="tsql")
```
Error Message:
```
Exception has occurred: ParseError
Expecting ). Line 4, Col: 45.
bo.test (
id INT,
name VARCHAR(50),
CONSTRAINT pk_testTable PRIMARY KEY (id [4mDESC[0m)
) ;
File "C:\*snip*\main.py", line 96, in main
parsed_script = sqlglot.parse(test, read="tsql")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\*snip*\main.py", line 116, in <module>
main()
sqlglot.errors.ParseError: Expecting ). Line 4, Col: 45.
bo.test (
id INT,
name VARCHAR(50),
CONSTRAINT pk_testTable PRIMARY KEY (id [4mDESC[0m)
) ;
```
Official Documentation: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql?view=sql-server-ver16#constraint
Edit: sqlglot version is 25.21.3.
|
@cchambers-rdi: Added version to OP.
|
2025-01-15T15:34:32Z
|
2025-01-15T15:34:32Z
|
0.3.88
|
[] |
[
"tests/dialects/test_tsql.py::TestTSQL::test_rollback",
"tests/dialects/test_tsql.py::TestTSQL::test_declare",
"tests/dialects/test_tsql.py::TestTSQL::test_datetrunc",
"tests/dialects/test_tsql.py::TestTSQL::test_transaction",
"tests/dialects/test_tsql.py::TestTSQL::test_eomonth",
"tests/dialects/test_tsql.py::TestTSQL::test_option",
"tests/dialects/test_tsql.py::TestTSQL::test_set",
"tests/dialects/test_tsql.py::TestTSQL::test_lateral_subquery",
"tests/dialects/test_tsql.py::TestTSQL::test_types_decimals",
"tests/dialects/test_tsql.py::TestTSQL::test_string",
"tests/dialects/test_tsql.py::TestTSQL::test_parsename",
"tests/dialects/test_tsql.py::TestTSQL::test_replicate",
"tests/dialects/test_tsql.py::TestTSQL::test_commit",
"tests/dialects/test_tsql.py::TestTSQL::test_identifier_prefixes",
"tests/dialects/test_tsql.py::TestTSQL::test_hints",
"tests/dialects/test_tsql.py::TestTSQL::test_types",
"tests/dialects/test_tsql.py::TestTSQL::test_json",
"tests/dialects/test_tsql.py::TestTSQL::test_isnull",
"tests/dialects/test_tsql.py::TestTSQL::test_date_diff",
"tests/dialects/test_tsql.py::TestTSQL::test_types_string",
"tests/dialects/test_tsql.py::TestTSQL::test_current_user",
"tests/dialects/test_tsql.py::TestTSQL::test_datename",
"tests/dialects/test_tsql.py::TestTSQL::test_udf",
"tests/dialects/test_tsql.py::TestTSQL::test_types_ints",
"tests/dialects/test_tsql.py::TestTSQL::test_top",
"tests/dialects/test_tsql.py::TestTSQL::test_lateral_table_valued_function",
"tests/dialects/test_tsql.py::TestTSQL::test_openjson",
"tests/dialects/test_tsql.py::TestTSQL::test_count",
"tests/dialects/test_tsql.py::TestTSQL::test_scope_resolution_op",
"tests/dialects/test_tsql.py::TestTSQL::test_len",
"tests/dialects/test_tsql.py::TestTSQL::test_system_time",
"tests/dialects/test_tsql.py::TestTSQL::test_temporal_table",
"tests/dialects/test_tsql.py::TestTSQL::test_fullproc",
"tests/dialects/test_tsql.py::TestTSQL::test_add_date",
"tests/dialects/test_tsql.py::TestTSQL::test_grant",
"tests/dialects/test_tsql.py::TestTSQL::test_format",
"tests/dialects/test_tsql.py::TestTSQL::test_convert",
"tests/dialects/test_tsql.py::TestTSQL::test_qualify_derived_table_outputs",
"tests/dialects/test_tsql.py::TestTSQL::test_types_date",
"tests/dialects/test_tsql.py::TestTSQL::test_procedure_keywords",
"tests/dialects/test_tsql.py::TestTSQL::test_next_value_for",
"tests/dialects/test_tsql.py::TestTSQL::test_tsql",
"tests/dialects/test_tsql.py::TestTSQL::test_datefromparts",
"tests/dialects/test_tsql.py::TestTSQL::test_datepart",
"tests/dialects/test_tsql.py::TestTSQL::test_ddl",
"tests/dialects/test_tsql.py::TestTSQL::test_types_bin",
"tests/dialects/test_tsql.py::TestTSQL::test_insert_cte",
"tests/dialects/test_tsql.py::TestTSQL::test_charindex"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json tests/dialects/test_tsql.py",
"issue_number": 4610,
"merge_commit": "14474ee689025cc67b1f9a07e51d2f414ec5ab49",
"merged_at": "",
"pr_number": 4618,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/tobymao/sqlglot/pull/4618.diff",
"issue": "https://github.com/tobymao/sqlglot/issues/4610",
"pr": "https://github.com/tobymao/sqlglot/pull/4618"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json tests/dialects/test_tsql.py
|
|
MolSSI/QCElemental
|
MolSSI__QCElemental-350
|
cddc5313ad7a251501b633f119c2cb566885bcc1
|
diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml
index aa949f3..8aca4c9 100644
--- a/.github/workflows/CI.yaml
+++ b/.github/workflows/CI.yaml
@@ -17,7 +17,8 @@ jobs:
matrix:
python-version: ["3.7", "3.9", "3.11", "3.12"]
pydantic-version: ["1", "2"]
- runs-on: [ubuntu-latest, windows-latest]
+ # runs-on: [ubuntu-latest, windows-latest]
+ runs-on: [ubuntu-22.04, windows-latest] # until drop py37
exclude:
- runs-on: windows-latest
pydantic-version: "1"
diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml
index c337352..c52ea9a 100644
--- a/.github/workflows/Lint.yml
+++ b/.github/workflows/Lint.yml
@@ -14,7 +14,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: "3.7"
+ python-version: "3.8"
- name: Install black
run: pip install "black>=22.1.0,<23.0a0"
- name: Print code formatting with black (hints here if next step errors)
@@ -29,7 +29,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
- python-version: "3.7"
+ python-version: "3.8"
- name: Install poetry
run: pip install poetry
- name: Install repo
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 76edbc6..0cd1e4f 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -19,18 +19,19 @@ Changelog
.. Misc.
.. +++++
-- (:pr:`340`, :issue:`330`) Add molecular charge and multiplicity to Molecule repr formula,
- so neutral singlet unchanged but radical cation has '2^formula+'.
-
0.29.0 / 2024-MM-DD (Unreleased)
--------------------------------
Breaking Changes
++++++++++++++++
+- (:pr:`341`) `packaging` is now a required dependency.
New Features
++++++++++++
+- (:pr:`350`, :pr:`318`, :issue:`317`) Make behavior consistent between molecular_charge/
+ fragment_charges and molecular_multiplicity/fragment_multiplicities by allowing floating point
+ numbers for multiplicities. @awvwgk
- (:pr:`360`) ``Molecule`` learned new functions ``element_composition`` and ``molecular_weight``.
The first gives a dictionary of element symbols and counts, while the second gives the weight in amu.
Both can access the whole molecule or per-fragment like the existing ``nelectrons`` and
@@ -38,13 +39,30 @@ New Features
Enhancements
++++++++++++
+- (:pr:`340`, :issue:`330`) Add molecular charge and multiplicity to Molecule repr formula,
+ so neutral singlet unchanged but radical cation has '2^formula+'. @awvwgk
+- (:pr:`341`) Use `packaging` instead of deprecated `setuptools` to provide version parsing for
+ `qcelemental.util.parse_version` and `qcelemental.util.safe_version`. This behaves slightly
+ different; "v7.0.0+N/A" was processed ok before but fails with newer version. @berquist
+- (:pr:`343`) Molecular and fragment multiplicities are now always enforced to be >=1.0. Previously
+ this wasn't checked for `Molecule(..., validate=False)`. Error messages will change sometimes
+ change for `validate=True` (run by default).
+- (:pr:`343`) `qcelemental.molparse` newly allows floats that are ints (e.g., 1.0) for multiplicity.
+ Previously it would raise an error about not being an int.
+- (:pr:`337`) Solidify the (unchanged) schema_name for `QCInputSpecification` and `AtomicResult`
+ into Literals where previously they had been regex strings coerced into a single name. The literals
+ allow pydantic to discriminate models, which benefits GeneralizedOptimizationInput/Result in
+ QCManyBody/QCEngine/OptKing. The only way this can interfere is if schema producers have whitespace
+ around `schema_name` for these models or if any `AtomicResult`s are still using "qc_schema_output",
+ which looks to have only been added for compatibility with pre-pydantic QCSchema.
Bug Fixes
+++++++++
Misc.
+++++
-- (:pr:`342`) Update some docs settings and requirements for newer tools.
+- (:pr:`344`, :issue:`282`) Add a citation file since QCElemental doesn't have a paper. @lilyminium
+- (:pr:`342`, :issue:`333`) Update some docs settings and requirements for newer tools.
- (:pr:`353`) copied in pkg_resources.safe_version code as follow-up to Eric switch to packaging as both nwchem and gamess were now working.
the try_harder_safe_version might be even bettter
diff --git a/qcelemental/models/molecule.py b/qcelemental/models/molecule.py
index 63070d5..215db12 100644
--- a/qcelemental/models/molecule.py
+++ b/qcelemental/models/molecule.py
@@ -185,7 +185,7 @@ class Molecule(ProtoModel):
description="Additional comments for this molecule. Intended for pure human/user consumption and clarity.",
)
molecular_charge: float = Field(0.0, description="The net electrostatic charge of the molecule.") # type: ignore
- molecular_multiplicity: int = Field(1, description="The total multiplicity of the molecule.") # type: ignore
+ molecular_multiplicity: float = Field(1, description="The total multiplicity of the molecule.") # type: ignore
# Atom data
masses_: Optional[Array[float]] = Field( # type: ignore
@@ -257,7 +257,7 @@ class Molecule(ProtoModel):
"if not provided (and :attr:`~qcelemental.models.Molecule.fragments` are specified).",
shape=["nfr"],
)
- fragment_multiplicities_: Optional[List[int]] = Field( # type: ignore
+ fragment_multiplicities_: Optional[List[float]] = Field( # type: ignore
None,
description="The multiplicity of each fragment in the :attr:`~qcelemental.models.Molecule.fragments` list. The index of this "
"list matches the 0-index indices of :attr:`~qcelemental.models.Molecule.fragments` list. Will be filled in based on a set of "
@@ -421,12 +421,16 @@ class Molecule(ProtoModel):
n = len(values["fragments_"])
if len(v) != n:
raise ValueError("Fragment Multiplicities must be same number of entries as Fragments")
+ v = [(int(m) if m.is_integer() else m) for m in v]
if any([m < 1.0 for m in v]):
raise ValueError(f"Fragment Multiplicity must be positive: {v}")
return v
@validator("molecular_multiplicity")
def _int_if_possible(cls, v, values, **kwargs):
+ if v.is_integer():
+ # preserve existing hashes
+ v = int(v)
if v < 1.0:
raise ValueError("Molecular Multiplicity must be positive")
return v
@@ -502,7 +506,7 @@ class Molecule(ProtoModel):
return fragment_charges
@property
- def fragment_multiplicities(self) -> List[int]:
+ def fragment_multiplicities(self) -> List[float]:
fragment_multiplicities = self.__dict__.get("fragment_multiplicities_")
if fragment_multiplicities is None:
fragment_multiplicities = [self.molecular_multiplicity]
@@ -803,9 +807,7 @@ class Molecule(ProtoModel):
data = getattr(self, field)
if field == "geometry":
data = float_prep(data, GEOMETRY_NOISE)
- elif field == "fragment_charges":
- data = float_prep(data, CHARGE_NOISE)
- elif field == "molecular_charge":
+ elif field in ["fragment_charges", "molecular_charge", "fragment_multiplicities", "molecular_multiplicity"]:
data = float_prep(data, CHARGE_NOISE)
elif field == "masses":
data = float_prep(data, MASS_NOISE)
diff --git a/qcelemental/molparse/chgmult.py b/qcelemental/molparse/chgmult.py
index a311d08..493335c 100644
--- a/qcelemental/molparse/chgmult.py
+++ b/qcelemental/molparse/chgmult.py
@@ -19,7 +19,7 @@ def _high_spin_sum(mult_list):
def _mult_ok(m):
- return isinstance(m, (int, np.integer)) and m >= 1
+ return isinstance(m, (int, np.integer, float, np.float64)) and m >= 1
def _sufficient_electrons_for_mult(z, c, m):
@@ -430,7 +430,16 @@ def validate_and_fill_chgmult(
if molecular_multiplicity is None: # unneeded, but shortens the exact lists
frag_mult_hi = _high_spin_sum(_apply_default(fragment_multiplicities, 2))
frag_mult_lo = _high_spin_sum(_apply_default(fragment_multiplicities, 1))
- for m in range(frag_mult_lo, frag_mult_hi + 1):
+ try:
+ mult_range = range(frag_mult_lo, frag_mult_hi + 1)
+ except TypeError:
+ if frag_mult_lo == frag_mult_hi:
+ mult_range = [frag_mult_hi]
+ else:
+ raise ValidationError(
+ f"Cannot process: please fully specify float multiplicity: m: {molecular_multiplicity} fm: {fragment_multiplicities}"
+ )
+ for m in mult_range:
cgmp_exact_m.append(m)
# * (S6) suggest range of missing mult = tot - high_spin_sum(frag - 1),
@@ -450,7 +459,16 @@ def validate_and_fill_chgmult(
for ifr in range(nfr):
if fragment_multiplicities[ifr] is None: # unneeded, but shortens the exact lists
- for m in reversed(range(max(missing_mult_lo, 1), missing_mult_hi + 1)):
+ try:
+ mult_range = reversed(range(max(missing_mult_lo, 1), missing_mult_hi + 1))
+ except TypeError:
+ if missing_mult_lo == missing_mult_hi:
+ mult_range = [missing_mult_hi]
+ else:
+ raise ValidationError(
+ f"Cannot process: please fully specify float multiplicity: m: {molecular_multiplicity} fm: {fragment_multiplicities}"
+ )
+ for m in mult_range:
cgmp_exact_fm[ifr].append(m)
cgmp_exact_fm[ifr].append(1)
cgmp_exact_fm[ifr].append(2)
|
diff --git a/qcelemental/tests/test_molecule.py b/qcelemental/tests/test_molecule.py
index 46d7ced..b2154c0 100644
--- a/qcelemental/tests/test_molecule.py
+++ b/qcelemental/tests/test_molecule.py
@@ -2,6 +2,7 @@
Tests the imports and exports of the Molecule object.
"""
+
import numpy as np
import pytest
@@ -798,6 +799,15 @@ _ref_mol_multiplicity_hash = {
"triplet": "7caca87a",
"disinglet": "83a85546",
"ditriplet": "71d6ba82",
+ # float mult
+ "singlet_point1": "4e9e2587",
+ "singlet_epsilon": "ad3f5fab",
+ "triplet_point1": "ad35cc28",
+ "triplet_point1_minus": "b63d6983",
+ "triplet_point00001": "7107b7ac",
+ "disinglet_epsilon": "fb0aaaca",
+ "ditriplet_point1": "33d47d5f",
+ "ditriplet_point00001": "7f0ac640",
}
@@ -806,14 +816,26 @@ _ref_mol_multiplicity_hash = {
[
pytest.param(3, 3, False, "triplet"),
pytest.param(3, 3, True, "triplet"),
- # 3.1 -> 3 (validate=False) below documents the present bad behavior where a float mult
- # simply gets cast to int with no error. This will change soon. The validate=True throws a
- # nonspecific error that at least mentions type.
- pytest.param(3.1, 3, False, "triplet"),
+ # before float multiplicity was allowed, 3.1 (below) was coerced into 3 with validate=False,
+ # and validate=True threw a type-mentioning error. Now, 2.9 is allowed for both validate=T/F
+ pytest.param(3.1, 3.1, False, "triplet_point1"),
+ # validate=True counterpart fails b/c insufficient electrons in He for more than triplet
+ pytest.param(2.9, 2.9, False, "triplet_point1_minus"),
+ pytest.param(2.9, 2.9, True, "triplet_point1_minus"),
+ pytest.param(3.00001, 3.00001, False, "triplet_point00001"),
+ # validate=True counterpart fails like 3.1 above
+ pytest.param(2.99999, 2.99999, False, "triplet_point00001"), # hash agrees w/3.00001 above b/c <CHARGE_NOISE
+ pytest.param(2.99999, 2.99999, True, "triplet_point00001"),
pytest.param(3.0, 3, False, "triplet"),
pytest.param(3.0, 3, True, "triplet"),
pytest.param(1, 1, False, "singlet"),
pytest.param(1, 1, True, "singlet"),
+ pytest.param(1.000000000000000000002, 1, False, "singlet"),
+ pytest.param(1.000000000000000000002, 1, True, "singlet"),
+ pytest.param(1.000000000000002, 1.000000000000002, False, "singlet_epsilon"),
+ pytest.param(1.000000000000002, 1.000000000000002, True, "singlet_epsilon"),
+ pytest.param(1.1, 1.1, False, "singlet_point1"),
+ pytest.param(1.1, 1.1, True, "singlet_point1"),
pytest.param(None, 1, False, "singlet"),
pytest.param(None, 1, True, "singlet"),
# fmt: off
@@ -841,6 +863,9 @@ def test_mol_multiplicity_types(mult_in, mult_store, validate, exp_hash):
[
pytest.param(-3, False, "Multiplicity must be positive"),
pytest.param(-3, True, "Multiplicity must be positive"),
+ pytest.param(0.9, False, "Multiplicity must be positive"),
+ pytest.param(0.9, True, "Multiplicity must be positive"),
+ pytest.param(3.1, True, "Inconsistent or unspecified chg/mult"), # insufficient electrons in He
],
)
def test_mol_multiplicity_types_errors(mult_in, validate, error):
@@ -859,10 +884,11 @@ def test_mol_multiplicity_types_errors(mult_in, validate, error):
[
pytest.param(5, [3, 3], [3, 3], False, "ditriplet"),
pytest.param(5, [3, 3], [3, 3], True, "ditriplet"),
- # 3.1 -> 3 (validate=False) below documents the present bad behavior where a float mult
- # simply gets cast to int with no error. This will change soon. The validate=True throws a
- # irreconcilable error.
- pytest.param(5, [3.1, 3.4], [3, 3], False, "ditriplet"),
+ # before float multiplicity was allowed, [3.1, 3.4] (below) were coerced into [3, 3] with validate=False.
+ # Now, [2.9, 2.9] is allowed for both validate=T/F.
+ pytest.param(5, [3.1, 3.4], [3.1, 3.4], False, "ditriplet_point1"),
+ pytest.param(5, [2.99999, 3.00001], [2.99999, 3.00001], False, "ditriplet_point00001"),
+ pytest.param(5, [2.99999, 3.00001], [2.99999, 3.00001], True, "ditriplet_point00001"),
# fmt: off
pytest.param(5, [3.0, 3.], [3, 3], False, "ditriplet"),
pytest.param(5, [3.0, 3.], [3, 3], True, "ditriplet"),
@@ -871,6 +897,18 @@ def test_mol_multiplicity_types_errors(mult_in, validate, error):
pytest.param(1, [1, 1], [1, 1], True, "disinglet"),
# None in frag_mult not allowed for validate=False
pytest.param(1, [None, None], [1, 1], True, "disinglet"),
+ pytest.param(1, [1.000000000000000000002, 0.999999999999999999998], [1, 1], False, "disinglet"),
+ pytest.param(1, [1.000000000000000000002, 0.999999999999999999998], [1, 1], True, "disinglet"),
+ pytest.param(
+ 1,
+ [1.000000000000002, 1.000000000000004],
+ [1.000000000000002, 1.000000000000004],
+ False,
+ "disinglet_epsilon",
+ ),
+ pytest.param(
+ 1, [1.000000000000002, 1.000000000000004], [1.000000000000002, 1.000000000000004], True, "disinglet_epsilon"
+ ),
],
)
def test_frag_multiplicity_types(mol_mult_in, mult_in, mult_store, validate, exp_hash):
@@ -902,6 +940,9 @@ def test_frag_multiplicity_types(mol_mult_in, mult_in, mult_store, validate, exp
[
pytest.param([-3, 1], False, "Multiplicity must be positive"),
pytest.param([-3, 1], True, "Multiplicity must be positive"),
+ pytest.param(
+ [3.1, 3.4], True, "Inconsistent or unspecified chg/mult"
+ ), # insufficient e- for triplet+ on He in frag 1
],
)
def test_frag_multiplicity_types_errors(mult_in, validate, error):
diff --git a/qcelemental/tests/test_molparse_validate_and_fill_chgmult.py b/qcelemental/tests/test_molparse_validate_and_fill_chgmult.py
index 0c18649..0f85bb0 100644
--- a/qcelemental/tests/test_molparse_validate_and_fill_chgmult.py
+++ b/qcelemental/tests/test_molparse_validate_and_fill_chgmult.py
@@ -94,6 +94,12 @@ working_chgmults = [
(-2.4, [-2.4, 0, 0], 3, [1, 2, 2]),
"a83a3356",
), # 166
+ (("He", None, [None], 2.8, [None]), (0, [0], 2.8, [2.8]), "3e10e7b5"), # 180
+ (("He", None, [None], None, [2.8]), (0, [0], 2.8, [2.8]), "3e10e7b5"), # 181
+ (("N/N/N", None, [None, None, None], 2.2, [2, 2, 2.2]), (0, [0, 0, 0], 2.2, [2, 2, 2.2]), "798ee5d4"), # 183
+ (("N/N/N", None, [None, None, None], 4.2, [2, 2, 2.2]), (0, [0, 0, 0], 4.2, [2, 2, 2.2]), "ed6d1f35"), # 185
+ (("N/N/N", None, [None, None, None], None, [2, 2, 2.2]), (0, [0, 0, 0], 4.2, [2, 2, 2.2]), "ed6d1f35"), # 186
+ (("N/N/N", None, [2, -2, None], 2.2, [2, 2, 2.2]), (0, [2, -2, 0], 2.2, [2, 2, 2.2]), "66e655c0"), # 187
]
@@ -153,6 +159,8 @@ def test_validate_and_fill_chgmult_mol_model(systemtranslator, inp, expected, ex
("Gh", None, [None], 3, [None]), # 60
("Gh/He", None, [2, None], None, [None, None]), # 62
("Gh/Ne", 2, [-2, None], None, [None, None]), # 65b
+ ("He", None, [None], 3.2, [None]), # 182
+ ("N/N/N", None, [None, None, None], 2.2, [None, None, 2.2]), # 184
],
)
def test_validate_and_fill_chgmult_irreconcilable(systemtranslator, inp):
@@ -173,6 +181,8 @@ def test_validate_and_fill_chgmult_irreconcilable(systemtranslator, inp):
# 35 - insufficient electrons
# 55 - both (1, (1, 0.0, 0.0), 4, (1, 3, 2)) and (1, (0.0, 0.0, 1), 4, (2, 3, 1)) plausible
# 65 - non-0/1 on Gh fragment errors normally but reset by zero_ghost_fragments
+# 182 - insufficient electrons on He
+# 184 - decline to guess fragment multiplicities when floats involved
@pytest.fixture
|
Floating point number allowed for molecular charge but not molecular multiplicity
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
QCElemental allows floating point numbers for molecular charges, however when computing the spin with the fractional electron there is no way to represent the molecular multiplicity with just an integer.
**To Reproduce**
<!-- Code to reproduce the behavior: Please include the results of:-->
```python
import qcelemental as qcel
mol = qcel.models.Molecule(
geometry=[0.0, 0.0, 0.5, 0.0, 0.0, -0.5],
symbols=["H", "He"],
molecular_charge=0.5,
molecular_multiplicity=1.5, # not possible
)
```
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
Consistent behavior for specifying molecular charge and molecular multiplicity.
**Additional context**
<!-- Add any other context about the problem here. -->
|
@loriab: I'll make sure to bring this up to @bennybp to see if the database is ready for a type change.
|
2025-01-13T16:47:19Z
|
2025-01-13T16:47:19Z
|
0.4.3
|
[
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp50-expected50-]",
"qcelemental/tests/test_molecule.py::test_show",
"qcelemental/tests/test_molecule.py::test_molecule_serialization[msgpack]",
"qcelemental/tests/test_molecule.py::test_to_from_file_charge_spin[msgpack-msgpack]",
"qcelemental/tests/test_molecule.py::test_to_from_file_simple[msgpack-msgpack]",
"qcelemental/tests/test_molecule.py::test_molecule_serialization[msgpack-ext]"
] |
[
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp3-expected3-bfdcbd63]",
"qcelemental/tests/test_molecule.py::test_fragment_charge_configurations[0-4-0-2-0.0-5]",
"qcelemental/tests/test_molecule.py::test_pretty_print",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp16]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[4He 0 0 0-args8-He-formula_dict8-4.00260325413-2-0.0]",
"qcelemental/tests/test_molecule.py::test_sparse_molecule_fields[He 0 0 0-None]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\n@He 0 0 5-args2-He2-formula_dict2-4.00260325413-2-0.0]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3-3-True-triplet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp15]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0-args0-He-formula_dict0-4.00260325413-2-0.0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp22-expected22-9eb13213]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in10-mult_store10-False-disinglet]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3.0-3-False-triplet1]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp30-expected30-e9b8fe09]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp18]",
"qcelemental/tests/test_molecule.py::test_to_from_file_charge_spin[xyz+-xyz]",
"qcelemental/tests/test_molecule.py::test_sparse_molecule_fields[He 0 0 0\\n--\\n@He 0 0 5-extra_keys2]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp7-expected7-cd3a0ecd]",
"qcelemental/tests/test_molecule.py::test_measurements[measure0-1.8086677572537304]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp36-expected36-f4a99eac]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp6]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp51-expected51-684cec20]",
"qcelemental/tests/test_molecule.py::test_molecule_errors_connectivity",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp28-expected28-9445d8b9]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types_errors[-3-False-Multiplicity must be positive]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp25-expected25-809afce3]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1-1-False-singlet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp13-expected13-cc52833f]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp35-expected35-3a2ba1ea]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp42-expected42-38a20a23]",
"qcelemental/tests/test_molecule.py::test_fragment_charge_configurations[-1-1-1-1-0.0-1]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp55-expected55-3e10e7b5]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp34-expected34-ac9200ac]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp39-expected39-b381f350]",
"qcelemental/tests/test_molecule.py::test_to_from_file_simple[numpy-npy]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp24-expected24-74aba942]",
"qcelemental/tests/test_molecule.py::test_to_from_file_simple[json-json]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp52-expected52-7a5fd2d3]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp36-expected36-f4a99eac]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp23-expected23-512c204f]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp49-expected49-ffe022cd]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in6-mult_store6-True-ditriplet]",
"qcelemental/tests/test_molecule.py::test_orient_nomasses",
"qcelemental/tests/test_molecule.py::test_molecule_serialization[json]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp58-expected58-ed6d1f35]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp53-expected53-a83a3356]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\n@He 0 0 5-args3-He2-formula_dict3-4.00260325413-2-0.0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp12]",
"qcelemental/tests/test_molecule.py::test_to_string",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp19-expected19-3fa264e9]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types_errors[3.1-True-Inconsistent or unspecified chg/mult]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types_errors[mult_in1-True-Multiplicity must be positive]",
"qcelemental/tests/test_molecule.py::test_measurements[measure1-37.98890673587713]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp40-expected40-2d17a8fd]",
"qcelemental/tests/test_molecule.py::test_molecule_data_constructor_numpy",
"qcelemental/tests/test_molecule.py::test_molecule_errors_extra",
"qcelemental/tests/test_molecule.py::test_molecule_repeated_hashing",
"qcelemental/tests/test_molecule.py::test_water_orient",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp45-expected45-83330b29]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[2.9-2.9-True-triplet_point1_minus]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp8-expected8-e3ca63c8]",
"qcelemental/tests/test_molecule.py::test_to_from_file_charge_spin[json-json]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp9-expected9-8d70c7ec]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp21-expected21-0f1a1ffc]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\n@He 0 0 5-args5-He2-formula_dict5-8.00520650826-4-0.4233417684]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in12-mult_store12-False-disinglet_epsilon]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp0-expected0-b3855c64]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in3-mult_store3-False-ditriplet_point00001]",
"qcelemental/tests/test_molecule.py::test_good_isotope_spec",
"qcelemental/tests/test_molecule.py::test_water_minima_fragment",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1.000000000000002-1.000000000000002-False-singlet_epsilon]",
"qcelemental/tests/test_molecule.py::test_charged_fragment",
"qcelemental/tests/test_molecule.py::test_molecule_repr_chgmult",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp1-expected1-b3855c64]",
"qcelemental/tests/test_molecule.py::test_fragment_charge_configurations[0-2-0-2-0.0-3]",
"qcelemental/tests/test_molecule.py::test_molecule_data_constructor_error",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp1]",
"qcelemental/tests/test_molecule.py::test_fragment_charge_configurations[1-1-0-2-1.0-2]",
"qcelemental/tests/test_molecule.py::test_sparse_molecule_fields[He@3.14 0 0 0-extra_keys4]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in1-mult_store1-True-ditriplet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp9]",
"qcelemental/tests/test_molecule.py::test_from_data_kwargs",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp6-expected6-35a61864]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp46-expected46-dfc621eb]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp8]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp47-expected47-c828e6fd]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp4-expected4-bfdcbd63]",
"qcelemental/tests/test_molecule.py::test_sparse_molecule_fields[He4 0 0 0-extra_keys3]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3.0-3-False-triplet0]",
"qcelemental/tests/test_molecule.py::test_to_from_file_complex[psi4]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp25-expected25-809afce3]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp37-expected37-cb147b67]",
"qcelemental/tests/test_molecule.py::test_measurements[measure3-result3]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp56-expected56-798ee5d4]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp7-expected7-cd3a0ecd]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp8-expected8-e3ca63c8]",
"qcelemental/tests/test_molecule.py::test_molecule_compare",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[None-1-True-singlet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp20-expected20-516f623a]",
"qcelemental/tests/test_molecule.py::test_nonphysical_spec",
"qcelemental/tests/test_molecule.py::test_to_from_file_complex[json]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp15-expected15-b3855c64]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp54-expected54-3e10e7b5]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp33-expected33-59c6613a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp10-expected10-cf3e8c41]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\nHe 0 0 5-args1-He2-formula_dict1-8.00520650826-4-0.4233417684]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp18-expected18-ad36285a]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1.0-1-True-singlet]",
"qcelemental/tests/test_molecule.py::test_molecule_connectivity",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1.0-1-False-singlet]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in0-mult_store0-False-ditriplet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp20-expected20-516f623a]",
"qcelemental/tests/test_molecule.py::test_sparse_molecule_fields[He 0 0 0\\n--\\nHe 0 0 5-extra_keys1]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp38-expected38-7140d169]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp41-expected41-b3e87763]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp5]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp43-expected43-38a20a23]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1.1-1.1-False-singlet_point1]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in2-mult_store2-False-ditriplet_point1]",
"qcelemental/tests/test_molecule.py::test_extras",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp5-expected5-e7141038]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp4-expected4-bfdcbd63]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp1-expected1-b3855c64]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp14-expected14-cf3e8c41]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in9-mult_store9-True-disinglet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp17]",
"qcelemental/tests/test_molecule.py::test_molecule_json_serialization",
"qcelemental/tests/test_molecule.py::test_molecule_data_constructor_dict",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp11-expected11-9cd54b37]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp49-expected49-ffe022cd]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types_errors[-3-True-Multiplicity must be positive]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp3]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp9-expected9-8d70c7ec]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp40-expected40-2d17a8fd]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types_errors[mult_in2-True-Inconsistent or unspecified chg/mult]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp13]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1.000000000000002-1.000000000000002-True-singlet_epsilon]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp12-expected12-752ec2fe]",
"qcelemental/tests/test_molecule.py::test_molecule_np_constructors",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3.1-3.1-False-triplet_point1]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp51-expected51-684cec20]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp0-expected0-b3855c64]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp55-expected55-3e10e7b5]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[2.9-2.9-False-triplet_point1_minus]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp18-expected18-ad36285a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp42-expected42-38a20a23]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp21-expected21-0f1a1ffc]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp37-expected37-cb147b67]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp17-expected17-e5f7b504]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp56-expected56-798ee5d4]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp39-expected39-b381f350]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp17-expected17-e5f7b504]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp33-expected33-59c6613a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp15-expected15-b3855c64]",
"qcelemental/tests/test_molecule.py::test_molecule_serialization[json-ext]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\n@He 0 0 5-args7-He2-formula_dict7-4.00260325413-2-0.0]",
"qcelemental/tests/test_molecule.py::test_to_from_file_simple[xyz-xyz]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp19-expected19-3fa264e9]",
"qcelemental/tests/test_molecule.py::test_measurements[measure5-result5]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp35-expected35-3a2ba1ea]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp26-expected26-f91e3c77]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp4]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp31-expected31-59c6613a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp30-expected30-e9b8fe09]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp57-expected57-ed6d1f35]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1.1-1.1-True-singlet_point1]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp32-expected32-ccd5e698]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp41-expected41-b3e87763]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[1-1-True-singlet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp59-expected59-66e655c0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp12-expected12-752ec2fe]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp54-expected54-3e10e7b5]",
"qcelemental/tests/test_molecule.py::test_fragment_charge_configurations[1-1-1-1-2.0-1]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[2.99999-2.99999-True-triplet_point00001]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp57-expected57-ed6d1f35]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp2-expected2-ad36285a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp34-expected34-ac9200ac]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3-3-False-triplet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp3-expected3-bfdcbd63]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp11-expected11-9cd54b37]",
"qcelemental/tests/test_molecule.py::test_get_fragment[True-True]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp31-expected31-59c6613a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp2-expected2-ad36285a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp22-expected22-9eb13213]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp58-expected58-ed6d1f35]",
"qcelemental/tests/test_molecule.py::test_hash_canary",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp44-expected44-28064e3e]",
"qcelemental/tests/test_molecule.py::test_molecule_errors_shape",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types_errors[0.9-True-Multiplicity must be positive]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in13-mult_store13-True-disinglet_epsilon]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp5-expected5-e7141038]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp27-expected27-dc9720af]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3.0-3-True-triplet0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp2]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types_errors[mult_in0-False-Multiplicity must be positive]",
"qcelemental/tests/test_molecule.py::test_fragment_charge_configurations[0-2-1-1-1.0-2]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp52-expected52-7a5fd2d3]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in4-mult_store4-True-ditriplet_point00001]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp27-expected27-dc9720af]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp13-expected13-cc52833f]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp44-expected44-28064e3e]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp26-expected26-f91e3c77]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp11]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp43-expected43-38a20a23]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp29-expected29-dfcb8940]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp38-expected38-7140d169]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in7-mult_store7-False-disinglet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp45-expected45-83330b29]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[5He4 0 0 0-args9-He-formula_dict9-5.012057-2-0.0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp16-expected16-7caca87a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp48-expected48-54238534]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp29-expected29-dfcb8940]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp7]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He@3.14 0 0 0-args10-He-formula_dict10-3.14-2-0.0]",
"qcelemental/tests/test_molecule.py::test_sparse_molecule_connectivity",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp6-expected6-35a61864]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3.0-3-True-triplet1]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp16-expected16-7caca87a]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp50-expected50-]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp10-expected10-cf3e8c41]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp14]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp48-expected48-54238534]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp47-expected47-c828e6fd]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp28-expected28-9445d8b9]",
"qcelemental/tests/test_molecule.py::test_get_fragment[False-False]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp32-expected32-ccd5e698]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp23-expected23-512c204f]",
"qcelemental/tests/test_molecule.py::test_water_minima_data",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[2.99999-2.99999-False-triplet_point00001]",
"qcelemental/tests/test_molecule.py::test_nuclearrepulsionenergy_nelectrons",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp53-expected53-a83a3356]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp59-expected59-66e655c0]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in8-mult_store8-True-disinglet]",
"qcelemental/tests/test_molecule.py::test_measurements[measure4-result4]",
"qcelemental/tests/test_molecule.py::test_bad_isotope_spec",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\n@He 0 0 5-args4-He2-formula_dict4-0.0-0-0.0]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult[inp14-expected14-cf3e8c41]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[None-1-False-singlet]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_irreconcilable[inp10]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp46-expected46-dfc621eb]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[5-mult_in5-mult_store5-False-ditriplet]",
"qcelemental/tests/test_molecule.py::test_frag_multiplicity_types[1-mult_in11-mult_store11-True-disinglet]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types_errors[0.9-False-Multiplicity must be positive]",
"qcelemental/tests/test_molparse_validate_and_fill_chgmult.py::test_validate_and_fill_chgmult_mol_model[inp24-expected24-74aba942]",
"qcelemental/tests/test_molecule.py::test_molecular_weight[He 0 0 0\\n--\\n@He 0 0 5-args6-He2-formula_dict6-4.00260325413-2-0.0]",
"qcelemental/tests/test_molecule.py::test_mol_multiplicity_types[3.00001-3.00001-False-triplet_point00001]",
"qcelemental/tests/test_molecule.py::test_measurements[measure2-180.0]"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json qcelemental/tests/test_molparse_validate_and_fill_chgmult.py qcelemental/tests/test_molecule.py",
"issue_number": 317,
"merge_commit": "1908ccc4228544f7c5dd02be7b660f2fc4e73ade",
"merged_at": "",
"pr_number": 350,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/MolSSI/QCElemental/pull/350.diff",
"issue": "https://github.com/MolSSI/QCElemental/issues/317",
"pr": "https://github.com/MolSSI/QCElemental/pull/350"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json qcelemental/tests/test_molparse_validate_and_fill_chgmult.py qcelemental/tests/test_molecule.py
|
|
PyCQA/pyflakes
|
PyCQA__pyflakes-831
|
433dfd001746a69d12597f7c97af78c13e1f662e
|
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index c7d3e882..9888d7ac 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1008,8 +1008,12 @@ def addBinding(self, node, value):
for scope in reversed(self.scopeStack)
if not isinstance(scope, GeneratorScope)
)
- # it may be a re-assignment to an already existing name
- scope.setdefault(value.name, value)
+ if value.name in scope and isinstance(scope[value.name], Annotation):
+ # re-assignment to name that was previously only an annotation
+ scope[value.name] = value
+ else:
+ # it may be a re-assignment to an already existing name
+ scope.setdefault(value.name, value)
else:
self.scope[value.name] = value
|
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index 68c38e95..23990820 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -1744,6 +1744,13 @@ def test_assign_expr(self):
print(x)
''')
+ def test_assign_expr_after_annotation(self):
+ self.flakes("""
+ a: int
+ print(a := 3)
+ print(a)
+ """)
+
def test_assign_expr_generator_scope(self):
"""Test assignment expressions in generator expressions."""
self.flakes('''
|
Walrus operator + annotation can cause F821 in version 3.3.0
In order to type hint a variable used in a walrus expression, I put the type hint outside of the expression like in the following example (test.py):
```
a: int
if a := 3:
print(a)
print(a)
```
Variable "a" is defined in both places
```
$ python3 test.py
3
3
```
In pyflakes version 3.2.0 this produced no errors
```pip install flake8==7.1.2 pyflakes==3.2.0```
```
$ flake8 test.py
```
In pyflakes version 3.3.0 this produces F821 even though "a" is defined
```pip install flake8==7.2.0 pyflakes==3.3.0```
```
$ flake8 test.py
test.py:3:11: F821 undefined name 'a'
test.py:5:7: F821 undefined name 'a'
```
I am on Windows with Python version 3.12.8
|
@sigmavirus24: Thanks for reporting and fixing!
|
2025-03-30T21:54:34Z
|
2025-03-30T21:54:34Z
|
0.3.88
|
[
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedReassignedVariable",
"pyflakes/test/test_other.py::Test::test_doubleAssignment"
] |
[
"pyflakes/test/test_other.py::TestStringFormatting::test_invalid_percent_format_calls",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait",
"pyflakes/test/test_other.py::Test::test_duplicateArgs",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop",
"pyflakes/test/test_other.py::Test::test_varAugmentedAssignment",
"pyflakes/test/test_other.py::Test::test_unused_global_statement_not_marked_as_used_by_nested_scope",
"pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented",
"pyflakes/test/test_other.py::Test::test_redefinedInGenerator",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined",
"pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined",
"pyflakes/test/test_other.py::Test::test_extendedSlice",
"pyflakes/test/test_other.py::Test::test_modernProperty",
"pyflakes/test/test_other.py::Test::test_containment",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDef",
"pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_setComprehensionAndLiteral",
"pyflakes/test/test_other.py::Test::test_continueOutsideLoop",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined",
"pyflakes/test/test_other.py::Test::test_starredAssignmentNoError",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal",
"pyflakes/test/test_other.py::Test::test_redefined_function_shadows_variable",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar",
"pyflakes/test/test_other.py::Test::test_classWithYieldFrom",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_in_lambda",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_without_message",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_dictComprehension",
"pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction",
"pyflakes/test/test_other.py::Test::test_classWithYield",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function",
"pyflakes/test/test_other.py::Test::test_classFunctionDecorator",
"pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals",
"pyflakes/test/test_other.py::Test::test_continueInsideLoop",
"pyflakes/test/test_other.py::Test::test_function_arguments",
"pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_function_assignment",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_valid_print",
"pyflakes/test/test_other.py::Test::test_function_arguments_python3",
"pyflakes/test/test_other.py::TestStringFormatting::test_f_string_without_placeholders",
"pyflakes/test/test_other.py::Test::test_redefinedClassFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future",
"pyflakes/test/test_other.py::Test::test_unused_nonlocal_statement",
"pyflakes/test/test_other.py::Test::test_breakOutsideLoop",
"pyflakes/test/test_other.py::Test::test_moduleWithYieldFrom",
"pyflakes/test/test_other.py::Test::test_defaultExceptNotLast",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple_empty",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementComplicatedTarget",
"pyflakes/test/test_other.py::Test::test_identity",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside",
"pyflakes/test/test_other.py::Test::test_attrAugmentedAssignment",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_if_tuple",
"pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNameDefinedInBody",
"pyflakes/test/test_other.py::Test::test_redefinedUnderscoreFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_debuggerskipSpecialVariable",
"pyflakes/test/test_other.py::TestAsyncStatements::test_formatstring",
"pyflakes/test/test_other.py::TestAsyncStatements::test_matmul",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall",
"pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension",
"pyflakes/test/test_other.py::Test::test_moduleWithReturn",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_nested",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking",
"pyflakes/test/test_other.py::Test::test_loopControl",
"pyflakes/test/test_other.py::Test::test_redefinedIfFunction",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementListNames",
"pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_f_string",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleName",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_augmented_assign",
"pyflakes/test/test_other.py::Test::test_moduleWithYield",
"pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse",
"pyflakes/test/test_other.py::Test::test_comparison",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNames",
"pyflakes/test/test_other.py::Test::test_redefinedFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined",
"pyflakes/test/test_other.py::Test::test_doubleAssignmentConditionally",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem",
"pyflakes/test/test_other.py::TestStringFormatting::test_invalid_dot_format_calls",
"pyflakes/test/test_other.py::Test::test_defaultExceptLast",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_static",
"pyflakes/test/test_other.py::Test::test_undefinedBaseClass",
"pyflakes/test/test_other.py::Test::test_unused_global_statement",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope_reassigns_parameter",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_generator_scope",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined",
"pyflakes/test/test_other.py::Test::test_classRedefinition",
"pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension",
"pyflakes/test/test_other.py::Test::test_unaryPlus",
"pyflakes/test/test_other.py::TestStringFormatting::test_ok_percent_format_cannot_determine_element_count",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal",
"pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName",
"pyflakes/test/test_other.py::Test::test_classWithReturn",
"pyflakes/test/test_other.py::Test::test_redefinedTryFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_tracebackhideSpecialVariable",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept",
"pyflakes/test/test_other.py::Test::test_starredAssignmentErrors",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable",
"pyflakes/test/test_other.py::Test::test_functionDecorator",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_as_condition_test",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assign_expr_after_annotation",
"pyflakes/test/test_other.py::Test::test_breakInsideLoop",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNoNames",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_with_message",
"pyflakes/test/test_other.py::Test::test_doubleAssignmentWithUse",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept",
"pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction",
"pyflakes/test/test_other.py::Test::test_ellipsis",
"pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals",
"pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exception_unused_in_except_star"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json pyflakes/test/test_other.py",
"issue_number": 830,
"merge_commit": "87051d20e2f5054302f1a5785c6b5a2c83a39cba",
"merged_at": "",
"pr_number": 831,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/PyCQA/pyflakes/pull/831.diff",
"issue": "https://github.com/PyCQA/pyflakes/issues/830",
"pr": "https://github.com/PyCQA/pyflakes/pull/831"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json pyflakes/test/test_other.py
|
|
tobymao/sqlglot
|
tobymao__sqlglot-5015
|
06db2350a1c625cc30212912a73267127fc4f3ea
|
diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py
index 97589d5fbd..61a6dba438 100644
--- a/sqlglot/dialects/postgres.py
+++ b/sqlglot/dialects/postgres.py
@@ -742,3 +742,12 @@ def isascii_sql(self, expression: exp.IsAscii) -> str:
@unsupported_args("this")
def currentschema_sql(self, expression: exp.CurrentSchema) -> str:
return "CURRENT_SCHEMA"
+
+ def interval_sql(self, expression: exp.Interval) -> str:
+ unit = expression.text("unit").lower()
+
+ if unit.startswith("quarter") and isinstance(expression.this, exp.Literal):
+ expression.this.replace(exp.Literal.number(int(expression.this.to_py()) * 3))
+ expression.args["unit"].replace(exp.var("MONTH"))
+
+ return super().interval_sql(expression)
|
diff --git a/tests/dialects/test_postgres.py b/tests/dialects/test_postgres.py
index 957eb9d5b9..c732688e55 100644
--- a/tests/dialects/test_postgres.py
+++ b/tests/dialects/test_postgres.py
@@ -372,6 +372,14 @@ def test_postgres(self):
pretty=True,
)
+ self.validate_all(
+ "SELECT CURRENT_TIMESTAMP + INTERVAL '-3 MONTH'",
+ read={
+ "mysql": "SELECT DATE_ADD(CURRENT_TIMESTAMP, INTERVAL -1 QUARTER)",
+ "postgres": "SELECT CURRENT_TIMESTAMP + INTERVAL '-3 MONTH'",
+ "tsql": "SELECT DATEADD(QUARTER, -1, GETDATE())",
+ },
+ )
self.validate_all(
"SELECT ARRAY[]::INT[] AS foo",
write={
|
[BUG] Conversion from SQL Server's DATEADD(quarter...) to PostgreSQL not working properly
## Type of issue: Bug Report
Conversion from SQL Server's DATEADD(quarter...) to PostgreSQL not working properly
## Description
When trying to convert SQL on read dialect 'tsql' for SQL Server's DATEADD(quarter...) the conversion is not correct and does not fail
## Steps to reproduce
```python
import sqlglot
example_query = "SELECT category, SUM(revenue) as total_revenue FROM events WHERE event_date >= DATEADD(quarter, -1, GETDATE()) GROUP BY category;"
parsed_postgres = sqlglot.transpile(example_query , read="tsql", write="postgres")
print(parsed_postgres)
```
## Expected behaviour
This conversion should show something like:
```sql
SELECT category, SUM(revenue) AS total_revenue FROM events WHERE event_date >= CURRENT_TIMESTAMP + INTERVAL '-3 MONTHS' GROUP BY category
```
## Actual behavior
Right now it will show:
```sql
SELECT category, SUM(revenue) AS total_revenue FROM events WHERE event_date >= CURRENT_TIMESTAMP + INTERVAL '-1 QUARTER' GROUP BY category
```
## Notes
1. The current behavior will fail because, as shown in [postgres docs](https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT), QUARTER is not supported. However, the structure of the query is correct. Changing this "N QUARTER" to "3*N months" should work.
2. The number before "QUARTER" does not matter, that's why it should always be 3 times the number of quarter months.
Thanks for this amazing library I just discovered it and it's coming handy! 💯
|
2025-04-25T21:40:11Z
|
2025-04-25T21:40:11Z
|
0.3.88
|
[] |
[
"tests/dialects/test_postgres.py::TestPostgres::test_array_length",
"tests/dialects/test_postgres.py::TestPostgres::test_bool_or",
"tests/dialects/test_postgres.py::TestPostgres::test_json_extract",
"tests/dialects/test_postgres.py::TestPostgres::test_xmlelement",
"tests/dialects/test_postgres.py::TestPostgres::test_regexp_binary",
"tests/dialects/test_postgres.py::TestPostgres::test_postgres",
"tests/dialects/test_postgres.py::TestPostgres::test_unnest_json_array",
"tests/dialects/test_postgres.py::TestPostgres::test_analyze",
"tests/dialects/test_postgres.py::TestPostgres::test_recursive_cte",
"tests/dialects/test_postgres.py::TestPostgres::test_variance",
"tests/dialects/test_postgres.py::TestPostgres::test_ddl",
"tests/dialects/test_postgres.py::TestPostgres::test_operator",
"tests/dialects/test_postgres.py::TestPostgres::test_unnest",
"tests/dialects/test_postgres.py::TestPostgres::test_rows_from",
"tests/dialects/test_postgres.py::TestPostgres::test_array_offset",
"tests/dialects/test_postgres.py::TestPostgres::test_string_concat"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json tests/dialects/test_postgres.py",
"issue_number": 5013,
"merge_commit": "60103020879db5f23a6c4a1775848e31cce13415",
"merged_at": "",
"pr_number": 5015,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/tobymao/sqlglot/pull/5015.diff",
"issue": "https://github.com/tobymao/sqlglot/issues/5013",
"pr": "https://github.com/tobymao/sqlglot/pull/5015"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json tests/dialects/test_postgres.py
|
||
matthewwithanm/python-markdownify
|
matthewwithanm__python-markdownify-217
|
e29de4e75314daf9267f30f47fd7a091ef5f1deb
|
diff --git a/markdownify/__init__.py b/markdownify/__init__.py
index 780761c..a43f3a7 100644
--- a/markdownify/__init__.py
+++ b/markdownify/__init__.py
@@ -650,6 +650,9 @@ def convert_pre(self, el, text, parent_tags):
return '\n\n```%s\n%s\n```\n\n' % (code_language, text)
+ def convert_q(self, el, text, parent_tags):
+ return '"' + text + '"'
+
def convert_script(self, el, text, parent_tags):
return ''
|
diff --git a/tests/test_conversions.py b/tests/test_conversions.py
index 27951ee..6145411 100644
--- a/tests/test_conversions.py
+++ b/tests/test_conversions.py
@@ -305,6 +305,11 @@ def test_pre():
assert md("<p>foo</p>\n<pre>bar</pre>\n</p>baz</p>", sub_symbol="^") == "\n\nfoo\n\n```\nbar\n```\n\nbaz"
+def test_q():
+ assert md('foo <q>quote</q> bar') == 'foo "quote" bar'
+ assert md('foo <q cite="https://example.com">quote</q> bar') == 'foo "quote" bar'
+
+
def test_script():
assert md('foo <script>var foo=42;</script> bar') == 'foo bar'
|
Inline Quotation element ignored
Html that looks like this:
```html
Here is <q>A Quote</q> from someone.
```
should be rendered as:
```
Here is “A Quote“ from someone.
```
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/q
Solution:
```python
def convert_q(self, el, text, parent_tags):
return '“' + text + '“'
```
|
@chrispy-snps: @colinrobinsonuib - good catch! We should probably use straight ASCII quotes for wider compatibility with downstream flows.
Are you interested in opening a pull request and officially becoming a contributor?@colinrobinsonuib: Sure https://github.com/matthewwithanm/python-markdownify/pull/217
|
2025-04-28T10:37:33Z
|
2025-04-28T10:37:33Z
|
0.3.88
|
[] |
[
"tests/test_conversions.py::test_kbd",
"tests/test_conversions.py::test_hn_atx_headings",
"tests/test_conversions.py::test_b",
"tests/test_conversions.py::test_code",
"tests/test_conversions.py::test_hn_atx_closed_headings",
"tests/test_conversions.py::test_a_spaces",
"tests/test_conversions.py::test_blockquote_with_nested_paragraph",
"tests/test_conversions.py::test_p",
"tests/test_conversions.py::test_q",
"tests/test_conversions.py::test_spaces",
"tests/test_conversions.py::test_em",
"tests/test_conversions.py::test_header_with_space",
"tests/test_conversions.py::test_div_section_article",
"tests/test_conversions.py::test_i",
"tests/test_conversions.py::test_pre",
"tests/test_conversions.py::test_a",
"tests/test_conversions.py::test_blockquote_nested",
"tests/test_conversions.py::test_br",
"tests/test_conversions.py::test_hn_chained",
"tests/test_conversions.py::test_a_shortcut",
"tests/test_conversions.py::test_samp",
"tests/test_conversions.py::test_sup",
"tests/test_conversions.py::test_hn_nested_tag_heading_style",
"tests/test_conversions.py::test_head",
"tests/test_conversions.py::test_blockquote_with_paragraph",
"tests/test_conversions.py::test_b_spaces",
"tests/test_conversions.py::test_s",
"tests/test_conversions.py::test_hr",
"tests/test_conversions.py::test_img",
"tests/test_conversions.py::test_sub",
"tests/test_conversions.py::test_script",
"tests/test_conversions.py::test_h1",
"tests/test_conversions.py::test_video",
"tests/test_conversions.py::test_strong",
"tests/test_conversions.py::test_h2",
"tests/test_conversions.py::test_a_no_autolinks",
"tests/test_conversions.py::test_dl",
"tests/test_conversions.py::test_lang",
"tests/test_conversions.py::test_hn",
"tests/test_conversions.py::test_strong_em_symbol",
"tests/test_conversions.py::test_blockquote",
"tests/test_conversions.py::test_figcaption",
"tests/test_conversions.py::test_hn_newlines",
"tests/test_conversions.py::test_del",
"tests/test_conversions.py::test_hn_nested_simple_tag",
"tests/test_conversions.py::test_a_with_title",
"tests/test_conversions.py::test_lang_callback",
"tests/test_conversions.py::test_hn_nested_img",
"tests/test_conversions.py::test_a_in_code",
"tests/test_conversions.py::test_style"
] |
pip install -e .;
pip install pytest pytest-json-report;
|
pytest --json-report --json-report-file=report_pytest.json
|
python:3.11
|
{
"command_test_small": "pytest --json-report --json-report-file=report_pytest.json tests/test_conversions.py",
"issue_number": 216,
"merge_commit": "0e1a849346f24e9b15eefb11752feaf7b4b821fa",
"merged_at": "",
"pr_number": 217,
"score": {
"complexity": -1,
"task_correctness": -1,
"test_completeness": -1,
"test_correctness": -1
},
"tag": "swb25_250629",
"task_id": null,
"type": "python pytest",
"url": {
"diff": "https:///github.com/matthewwithanm/python-markdownify/pull/217.diff",
"issue": "https://github.com/matthewwithanm/python-markdownify/issues/216",
"pr": "https://github.com/matthewwithanm/python-markdownify/pull/217"
}
}
| 3,000 | 600 |
pytest --json-report --json-report-file=report_pytest.json tests/test_conversions.py
|
SWE-MERA
Continuously updated SWE-MERA dataset
SWE-MERA splits:
- dev: for testing (10 samples)
- lite: presented at the leaderboard here (750 samples)
- full: continuously updated to collect more data (2738 samples)
Load dataset
from datasets import load_dataset
ds = load_dataset("MERA-evaluation/SWE-MERA", split='dev')
Evaluation
Description
The main tool to validate tasks is repotest (available at PyPI or GitHub)
data.jsonl
- dataset file, where after the agent run, the patch
column was changed
Install dependencies
pip install repositorytest
Run evaluation
swemera --fn_input=data.jsonl --fn_output=submission.jsonl --column_patch=patch --mode=docker
If you don't want to use Docker and prefer Conda or local execution:
swemera --fn_input=data.jsonl --fn_output=submission.jsonl --column_patch=patch --mode=local
Schema
Column Name | Type | Description | Is New Column |
---|---|---|---|
repo | VARCHAR | Repository name (e.g., GitHub repository) | False |
instance_id | VARCHAR | Unique identifier for task: f"{repo.replace('/', '_') + '' + pr_number}" | False |
base_commit | VARCHAR | Commit hash of the base code before patch applied | False |
patch | VARCHAR | Code patch or diff applied to the base_commit to be the correct solution | False |
test_patch | VARCHAR | Patch for test code, if separate from main code patch | False |
problem_statement | VARCHAR | Description or statement of the problem to solve | False |
hint_text | VARCHAR | Hints or tips for solving the problem from GitHub issue comments | False |
created_at | VARCHAR | Date when the instance was created | False |
closed_at | VARCHAR | Date when the instance was closed or resolved | True |
version | VARCHAR | Version identifier for the instance or dataset | False |
FAIL_TO_PASS | LIST[VARCHAR] | Test cases which were failing but later passed | False |
PASS_TO_PASS | LIST[VARCHAR] | Test cases which passed at all times | False |
environment_setup_commit | VARCHAR | Commit hash for environment setup configuration | False |
command_build | VARCHAR | Command used to build the repo | True |
command_test | VARCHAR | Command used to run the tests inside repo | True |
image_name | VARCHAR | Docker or container image name used for testing environment | True |
command_test_small | VARCHAR | Command to run a smaller subset of tests | True |
timeout_build | INTEGER | Timeout limit in seconds for build command | True |
timeout_test | INTEGER | Timeout limit in seconds for test command | True |
meta | DICT[STR,ANY] | Additional metadata about the instance* |
*meta field description:
{
"score": {
"task_correctness": "INTEGER",
"test_correctness": "INTEGER",
"complexity": "INTEGER",
"test_completeness": "INTEGER"
},
"type": "VARCHAR",
"pr_number": "INTEGER",
"issue_number": "INTEGER",
"merged_at": "VARCHAR",
"tag": "VARCHAR // Information on how data was collected",
"merge_commit": "VARCHAR",
"task_id": "VARCHAR // Latency identifier of the task",
"url": {
"issue": "VARCHAR",
"pr": "VARCHAR",
"diff": "VARCHAR"
},
"command_test_small": "VARCHAR // Command to run only a small number of tests"
}
Dev tasks Examples
Instances
Instance ID | Short Title |
---|---|
reframe-0 | Performance threshold goes to -inf when it should be zero. |
pyflakes-1 | Walrus operator + annotation can cause F821 |
sqlglot-2 | MySQL dialect fails to parse PRIMARY KEY USING BTREE syntax |
matchms-3 | matchms fails when reading spectra where abundance is in scientific notation #809 |
guarddog-4 | Add Mach-O magic bytes to bundled binary detector #523 |
pdoc-5 | Include HTML headers in ToC |
QCElemental-6 | QCElemental allows floating point numbers for molecular charges, however when computing the spin with the fractional electron there is no way to represent the molecular multiplicity with just an integer. |
sqlglot-7 | TSQL: PRIMARY KEY constraint fails to parse if |
sqlglot-8 | [BUG] Conversion from SQL Server's DATEADD(quarter...) to PostgreSQL not working properly |
python-markdownify-9 | Inline Quotation element ignored |
- Downloads last month
- 30