Skip to content

Commit

Permalink
Fixed a few more examples of 'd.has_key(k)' to use 'k in d' instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjc committed Jul 5, 2010
1 parent ae0845c commit 07a43ad
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Tests/test_Crystal.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ def testKeys(self):
self.assertEqual(self.crystal.keys(), self.crystal.data.keys())

def testHasKey(self):
self.assertTrue(self.crystal.has_key('b'))
self.assertTrue(self.crystal.has_key('c'))
self.assertFalse(self.crystal.has_key('z'))
self.assertTrue('b' in self.crystal)
self.assertTrue('c' in self.crystal)
self.assertFalse('z' in self.crystal)


class HeteroTestCase(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_GFF.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# only do the test if we are set up to do it. We need to have MYSQLPASS
# set and have a GFF wormbase installed (see the code in Bio/GFF/__init_.py
if not os.environ.has_key("MYSQLPASS"):
if "MYSQLPASS" not in os.environ:
raise MissingExternalDependencyError("Environment is not configured for this test (not important if you do not plan to use Bio.GFF).")

import warnings
Expand Down
13 changes: 6 additions & 7 deletions Tests/test_GraphicsChromosome.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,18 +239,17 @@ def test_widget(self):
properties = new_stdout.getvalue()
sys.stdout = save_stdout

assert properties.find(expected_string) >= 0, \
"Unexpected results from dumpProperties: \n %s" % properties
self.assertTrue(properties.find(expected_string) >= 0,
"Unexpected results from dumpProperties: \n %s" % properties)

properties = test_widget.getProperties()
assert properties.has_key("label_size") \
and properties["label_size"] == 6, \
"Unexpected results from getProperties: %s" % properties
self.assertEqual(properties["label_size"], 6,
"Unexpected results from getProperties: %s" % properties)

test_widget.setProperties({"start_x_position" : 12})
assert test_widget.start_x_position == 12, \
self.assertEqual(test_widget.start_x_position, 12,
"setProperties doesn't seem to work right: %s" \
% test_widget.start_x_position
% test_widget.start_x_position)

class ChromosomeCountTest(unittest.TestCase):
"""Test the display representation for simple counts on a chromosome.
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_Wise.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import doctest, unittest
import sys

if sys.modules.has_key('requires_wise'):
if 'requires_wise' in sys.modules:
del sys.modules['requires_wise']
import requires_wise

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_psw.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import random
import sys

if sys.modules.has_key('requires_wise'):
if 'requires_wise' in sys.modules:
del sys.modules['requires_wise']
import requires_wise

Expand Down

0 comments on commit 07a43ad

Please sign in to comment.