Commit e5b1faab by Chris Jerdonek

Fixed unittest warnings with Python 3: assertEquals() is deprecated.

parent 661b3ecd
...@@ -408,18 +408,18 @@ class ContextStackTests(unittest.TestCase, AssertIsMixin, AssertStringMixin): ...@@ -408,18 +408,18 @@ class ContextStackTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
def test_dot_notation__user_object(self): def test_dot_notation__user_object(self):
name = "foo.bar" name = "foo.bar"
stack = ContextStack({"foo": Attachable(bar="baz")}) stack = ContextStack({"foo": Attachable(bar="baz")})
self.assertEquals(stack.get(name), "baz") self.assertEqual(stack.get(name), "baz")
# Works on multiple levels, too # Works on multiple levels, too
name = "a.b.c.d.e.f.g" name = "a.b.c.d.e.f.g"
A = Attachable A = Attachable
stack = ContextStack({"a": A(b=A(c=A(d=A(e=A(f=A(g="w00t!"))))))}) stack = ContextStack({"a": A(b=A(c=A(d=A(e=A(f=A(g="w00t!"))))))})
self.assertEquals(stack.get(name), "w00t!") self.assertEqual(stack.get(name), "w00t!")
def test_dot_notation__mixed_dict_and_obj(self): def test_dot_notation__mixed_dict_and_obj(self):
name = "foo.bar.baz.bak" name = "foo.bar.baz.bak"
stack = ContextStack({"foo": Attachable(bar={"baz": Attachable(bak=42)})}) stack = ContextStack({"foo": Attachable(bar={"baz": Attachable(bak=42)})})
self.assertEquals(stack.get(name), 42) self.assertEqual(stack.get(name), 42)
def test_dot_notation__missing_attr_or_key(self): def test_dot_notation__missing_attr_or_key(self):
name = "foo.bar.baz.bak" name = "foo.bar.baz.bak"
...@@ -460,11 +460,11 @@ class ContextStackTests(unittest.TestCase, AssertIsMixin, AssertStringMixin): ...@@ -460,11 +460,11 @@ class ContextStackTests(unittest.TestCase, AssertIsMixin, AssertStringMixin):
# When any element in the path is callable, it should be automatically invoked # When any element in the path is callable, it should be automatically invoked
stack = ContextStack({"foo": Attachable(bar=Attachable(baz=lambda: "Called!"))}) stack = ContextStack({"foo": Attachable(bar=Attachable(baz=lambda: "Called!"))})
self.assertEquals(stack.get(name), "Called!") self.assertEqual(stack.get(name), "Called!")
class Foo(object): class Foo(object):
def bar(self): def bar(self):
return Attachable(baz='Baz') return Attachable(baz='Baz')
stack = ContextStack({"foo": Foo()}) stack = ContextStack({"foo": Foo()})
self.assertEquals(stack.get(name), "Baz") self.assertEqual(stack.get(name), "Baz")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment