Skip to content

Commit

Permalink
Merge pull request #3072 from tirkarthi/fix-warnings
Browse files Browse the repository at this point in the history
Fix syntax warning over comparison of literals using is.
  • Loading branch information
tylerjereddy authored Jan 5, 2021
2 parents 87e71bb + a758a7a commit 0de538e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions package/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Chronological list of authors
- Nicholas Craven
- Mieczyslaw Torchala
- Haochuan Chen
- Karthikeyan Singaravelan
2021
- Aditya Kamath

Expand Down
6 changes: 4 additions & 2 deletions package/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ The rules for this file:
??/??/?? tylerjereddy, richardjgowers, IAlibay, hmacdope, orbeckst, cbouy,
lilyminium, daveminh, jbarnoud, yuxuanzhuang, VOD555, ianmkenney,
calcraven,xiki-tempula, mieczyslaw, manuel.nuno.melo, PicoCentauri,
hanatok, rmeli, aditya-kamath
hanatok, rmeli, aditya-kamath, tirkarthi

* 2.0.0

Fixes
* atommethods(_get_prev/next_residues_by_resid) returns empty residue group when given empty residue group (Issue #3089)
* atommethods (_get_prev/next_residues_by_resid) returns empty residue group
when given empty residue group (Issue #3089)
* MOL2 files without bonds can now be read and written (Issue #3057)
* Write `CONECT` record only once in multi-model PDB files (Issue #3018)
* Add '.nc' as a recognised extension for the NCDFWriter (Issue #3030)
Expand Down Expand Up @@ -76,6 +77,7 @@ Fixes
(Issue #2934)
* Fix tests for analysis.bat that could fail when run in parallel and that
would create a test artifact (Issue #2979, PR #2981)
* Fix syntax warning over comparison of literals using is (Issue #3066)

Enhancements
* Added automatic selection class generation for TopologyAttrs,
Expand Down
2 changes: 1 addition & 1 deletion package/MDAnalysis/analysis/legacy/x3dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def plot(self, **kwargs):
ax.set_xlabel(r"Nucleic Acid Number")
param = self.profiles.values()[0].dtype.names[k]
if param in ["Shear", "Stretch", "Stagger", "Rise", "Shift", "Slide"]:
ax.set_ylabel("{0!s} ($\AA$)".format((param)))
ax.set_ylabel(r"{!s} ($\AA$)".format(param))
else:
ax.set_ylabel("{0!s} (deg)".format((param)))
ax.figure.savefig("{0!s}.png".format((param)))
Expand Down
14 changes: 7 additions & 7 deletions testsuite/MDAnalysisTests/lib/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,7 @@ def test_static_variables(self):

@static_variables(foo=0, bar={'test': x})
def myfunc():
assert myfunc.foo is 0
assert myfunc.foo == 0
assert type(myfunc.bar) is type(dict())
if 'test2' not in myfunc.bar:
myfunc.bar['test2'] = "a"
Expand All @@ -1488,14 +1488,14 @@ def myfunc():

y = myfunc()
assert y is x
assert x[0] is 1
assert myfunc.bar['test'][0] is 1
assert x[0] == 1
assert myfunc.bar['test'][0] == 1
assert myfunc.bar['test2'] == "a"

x = [0]
y = myfunc()
assert y is not x
assert myfunc.bar['test'][0] is 2
assert myfunc.bar['test'][0] == 2
assert myfunc.bar['test2'] == "aa"


Expand Down Expand Up @@ -1536,7 +1536,7 @@ def outer(group):
assert atoms.isunique
with pytest.warns(None) as w:
x = outer(atoms)
assert x is 0
assert x == 0
assert not w.list

# Check that a warning is raised for a group with duplicates:
Expand All @@ -1548,7 +1548,7 @@ def outer(group):
# Assert that the "warned" state is restored:
assert warn_if_not_unique.warned is False
# Check correct function execution:
assert x is 0
assert x == 0
# Only one warning must have been raised:
assert len(w) == 1
# For whatever reason pytest.warns(DuplicateWarning, match=msg)
Expand Down Expand Up @@ -1602,7 +1602,7 @@ def outer(group):
# Assert that the "warned" state is restored:
assert warn_if_not_unique.warned is False
# Check correct function execution:
assert x is 0
assert x == 0
# Only one warning must have been raised:
assert len(w) == 1
assert w[0].message.args[0] == msg
Expand Down

0 comments on commit 0de538e

Please sign in to comment.