File fix-test-assertions.patch of Package python-chai
Index: chai-1.1.2/tests/test_functional.py
===================================================================
--- chai-1.1.2.orig/tests/test_functional.py
+++ chai-1.1.2/tests/test_functional.py
@@ -20,7 +20,7 @@ class FunctionalTest(Chai):
foo = Foo()
expect(foo, 'prop').returns('foo').times(1)
- assert_equals( 'foo', foo.prop )
+ assert_equal( 'foo', foo.prop )
expect( stub(foo,'prop').setter ).args( 42 )
foo.prop = 42
@@ -39,7 +39,7 @@ class FunctionalTest(Chai):
expect(Foo.prop.setter).args(42)
expect(Foo.prop.deleter)
- assert_equals( 'foo', Foo().prop )
+ assert_equal( 'foo', Foo().prop )
Foo().prop = 42
del Foo().prop
with assert_raises( UnexpectedCall ):
@@ -56,7 +56,7 @@ class FunctionalTest(Chai):
expect(Foo.prop.deleter)
Foo().prop = 42
- assert_equals( 'foo', Foo().prop )
+ assert_equal( 'foo', Foo().prop )
del Foo().prop
def test_iterative_expectations(self):
@@ -65,25 +65,25 @@ class FunctionalTest(Chai):
return x
f = Foo()
- assert_equals(3, f.bar(3))
+ assert_equal(3, f.bar(3))
expect( f.bar )
- assert_equals( None, f.bar() )
+ assert_equal( None, f.bar() )
expect( f.bar ).returns( 4 )
- assert_equals( 4, f.bar() )
- assert_equals( 4, f.bar() )
+ assert_equal( 4, f.bar() )
+ assert_equal( 4, f.bar() )
expect( f.bar ).returns( 5 ).times(1)
- assert_equals( 5, f.bar() )
+ assert_equal( 5, f.bar() )
with assert_raises( UnexpectedCall ):
f.bar()
expect( f.bar ).args( 6 ).returns( 7 )
- assert_equals( 7, f.bar(6) )
+ assert_equal( 7, f.bar(6) )
expect( f.bar ).returns( 8 )
expect( f.bar ).returns( 9 )
- assert_equals( 8, f.bar() )
- assert_equals( 9, f.bar() )
- assert_equals( 9, f.bar() )
+ assert_equal( 8, f.bar() )
+ assert_equal( 9, f.bar() )
+ assert_equal( 9, f.bar() )
Index: chai-1.1.2/tests/test_sample.py
===================================================================
--- chai-1.1.2.orig/tests/test_sample.py
+++ chai-1.1.2/tests/test_sample.py
@@ -38,58 +38,58 @@ class SampleBaseTest(Chai):
def test_expects_property(self):
obj = SampleBase()
expect(obj, 'prop').returns("property value")
- assert_equals("property value", obj.prop)
+ assert_equal("property value", obj.prop)
def test_expects_on_builtin_function(self):
# NOTE: os module is a good example where it binds from another
# (e.g. posix), so it has to use the named reference or else it
# stubs the original module
expect(os, 'remove').args('foo').returns('ok')
- assert_equals('ok', os.remove('foo'))
+ assert_equal('ok', os.remove('foo'))
def test_expects_bound_method_returns(self):
obj = SampleBase()
expect(obj.bound_method).args(1, 2).returns(12)
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
expect(obj.bound_method).args(1, 4).returns(1100)
- assert_equals(1100, obj.bound_method(1, 4))
+ assert_equal(1100, obj.bound_method(1, 4))
def test_expects_bound_method_at_least_with_other_expectation_and_no_anyorder(self):
obj = SampleBase()
expect(obj.bound_method).args(1, 2).returns(12).at_least(2)
- assert_equals(12, obj.bound_method(1, 2))
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
expect(obj.bound_method).args(1, 3).returns(100)
- assert_equals(100, obj.bound_method(1, 3))
+ assert_equal(100, obj.bound_method(1, 3))
assert_raises(UnexpectedCall, obj.bound_method, 1, 2)
def test_expects_bound_method_at_least_with_other_expectation_and_anyorder(self):
obj = SampleBase()
expect(obj.bound_method).args(1, 2).returns(12).at_least(2).any_order()
- assert_equals(12, obj.bound_method(1, 2))
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
expect(obj.bound_method).args(1, 3).returns(100)
- assert_equals(100, obj.bound_method(1, 3))
+ assert_equal(100, obj.bound_method(1, 3))
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
def test_expects_bound_method_at_least_as_last_expectation(self):
obj = SampleBase()
expect(obj.bound_method).args(1, 2).returns(12).at_least(3)
- assert_equals(12, obj.bound_method(1, 2))
- assert_equals(12, obj.bound_method(1, 2))
- assert_equals(12, obj.bound_method(1, 2))
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
def test_expects_bound_method_at_most(self):
obj = SampleBase()
expect(obj.bound_method).args(1, 2).returns(12).at_most(3)
- assert_equals(12, obj.bound_method(1, 2))
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
obj.bound_method(1, 2)
assert_raises(UnexpectedCall, obj.bound_method, 1, 2)
@@ -97,30 +97,30 @@ class SampleBaseTest(Chai):
obj = SampleBase()
expect(obj.bound_method).args(1).returns(2).any_order()
expect(obj.bound_method).args(3).returns(4).any_order()
- assert_equals(4, obj.bound_method(3))
- assert_equals(2, obj.bound_method(1))
+ assert_equal(4, obj.bound_method(3))
+ assert_equal(2, obj.bound_method(1))
assert_raises(UnexpectedCall, obj.bound_method, 1)
def tests_expects_bound_method_any_order_with_mins(self):
obj = SampleBase()
expect(obj.bound_method).args(1).returns(2).any_order().at_least_once()
expect(obj.bound_method).args(3).returns(4).any_order().at_least_once()
- assert_equals(4, obj.bound_method(3))
- assert_equals(2, obj.bound_method(1))
- assert_equals(4, obj.bound_method(3))
- assert_equals(2, obj.bound_method(1))
- assert_equals(2, obj.bound_method(1))
- assert_equals(4, obj.bound_method(3))
- assert_equals(2, obj.bound_method(1))
+ assert_equal(4, obj.bound_method(3))
+ assert_equal(2, obj.bound_method(1))
+ assert_equal(4, obj.bound_method(3))
+ assert_equal(2, obj.bound_method(1))
+ assert_equal(2, obj.bound_method(1))
+ assert_equal(4, obj.bound_method(3))
+ assert_equal(2, obj.bound_method(1))
def test_expects_any_order_without_count_modifiers(self):
obj = SampleBase()
expect(obj.bound_method).args(3).returns(4)
expect(obj.bound_method).args(1).returns(2).any_order()
expect(obj.bound_method).args(3).returns(4)
- assert_equals(4, obj.bound_method(3))
- assert_equals(4, obj.bound_method(3))
- assert_equals(2, obj.bound_method(1))
+ assert_equal(4, obj.bound_method(3))
+ assert_equal(4, obj.bound_method(3))
+ assert_equal(2, obj.bound_method(1))
def test_expects_bound_method_raises(self):
obj = SampleBase()
@@ -133,11 +133,11 @@ class SampleBaseTest(Chai):
def test_expects_bound_method_can_be_used_for_iterative_testing(self):
obj = SampleBase()
expect(obj.bound_method).args(1, 2).returns(12)
- assert_equals(12, obj.bound_method(1, 2))
+ assert_equal(12, obj.bound_method(1, 2))
assert_raises(UnexpectedCall, obj.bound_method)
expect(obj.bound_method).args(1, 4).returns(1100)
- assert_equals(1100, obj.bound_method(1, 4))
+ assert_equal(1100, obj.bound_method(1, 4))
def test_stub_bound_method_raises_unexpectedcall(self):
obj = SampleBase()
@@ -190,8 +190,8 @@ class SampleBaseTest(Chai):
obj1 = SampleBase()
obj2 = SampleBase()
- assert_equals('world', obj2.bound_method('hello'))
- assert_equals('mars', obj1.bound_method('hello'))
+ assert_equal('world', obj2.bound_method('hello'))
+ assert_equal('mars', obj1.bound_method('hello'))
assert_raises(UnexpectedCall, obj2.bound_method)
def test_stub_unbound_method_acts_as_no_instance(self):
@@ -204,11 +204,11 @@ class SampleBaseTest(Chai):
def test_expects_class_method(self):
expect(SampleBase.a_classmethod).returns(12)
- assert_equals(12, SampleBase.a_classmethod())
+ assert_equal(12, SampleBase.a_classmethod())
obj = SampleBase()
expect(SampleBase.a_classmethod).returns(100)
- assert_equals(100, obj.a_classmethod())
+ assert_equal(100, obj.a_classmethod())
def test_stub_class_method(self):
stub(SampleBase.a_classmethod)
@@ -240,34 +240,34 @@ class SampleBaseTest(Chai):
def test_regex_comparator(self):
obj = SampleBase()
expect(obj.bound_method).args(matches("name$")).returns(100)
- assert_equals(obj.bound_method('first_name'), 100)
+ assert_equal(obj.bound_method('first_name'), 100)
def test_ignore_arg(self):
obj = SampleBase()
expect(obj.bound_method).args(ignore_arg()).returns(100)
- assert_equals(obj.bound_method('first_name'), 100)
+ assert_equal(obj.bound_method('first_name'), 100)
def test_function_comparator(self):
obj = SampleBase()
expect(obj.bound_method).args(func(lambda arg: arg > 10)).returns(100)
- assert_equals(obj.bound_method(100), 100)
+ assert_equal(obj.bound_method(100), 100)
def test_in_comparator(self):
obj = SampleBase()
expect(obj.bound_method).args(contains('name')).returns(100).at_most(3)
- assert_equals(obj.bound_method(['name', 'age']), 100)
- assert_equals(obj.bound_method({'name': 'vitaly'}), 100)
- assert_equals(obj.bound_method('lasfs-name-asfsad'), 100)
+ assert_equal(obj.bound_method(['name', 'age']), 100)
+ assert_equal(obj.bound_method({'name': 'vitaly'}), 100)
+ assert_equal(obj.bound_method('lasfs-name-asfsad'), 100)
def test_almost_equals_comparator(self):
obj = SampleBase()
expect(obj.bound_method).args(almost_equals(10.1234, 2)).returns(100)
- assert_equals(obj.bound_method(10.12), 100)
+ assert_equal(obj.bound_method(10.12), 100)
def test_is_comparator(self):
obj = SampleBase()
expect(obj.bound_method).args(is_arg(obj)).returns(100)
- assert_equals(obj.bound_method(obj), 100)
+ assert_equal(obj.bound_method(obj), 100)
def test_var_comparator(self):
obj = SampleBase()
@@ -281,9 +281,9 @@ class SampleBaseTest(Chai):
obj.add_to_list('v3')
self.assertRaises(UnexpectedCall, obj.add_to_list, 'v3a')
- assert_equals('v1', var('value1').value)
- assert_equals('v2', var('value2').value)
- assert_equals('v3', var('value3').value)
+ assert_equal('v1', var('value1').value)
+ assert_equal('v2', var('value2').value)
+ assert_equal('v3', var('value3').value)
def test_spy(self):
spy(SampleBase)
@@ -292,12 +292,12 @@ class SampleBaseTest(Chai):
spy(obj.add_to_list)
obj.add_to_list('v1')
- assert_equals(['v1'], list(obj._deque))
+ assert_equal(['v1'], list(obj._deque))
spy(obj.add_to_list).args(var('value2'))
obj.add_to_list('v2')
- assert_equals(['v1', 'v2'], list(obj._deque))
- assert_equals('v2', var('value2').value)
+ assert_equal(['v1', 'v2'], list(obj._deque))
+ assert_equal('v2', var('value2').value)
data = {'foo': 'bar'}
@@ -306,8 +306,8 @@ class SampleBaseTest(Chai):
spy(obj.add_to_list).side_effect(_sfx, data)
obj.add_to_list('v3')
- assert_equals(['v1', 'v2', 'v3'], list(obj._deque))
- assert_equals({'foo': 'bug'}, data)
+ assert_equal(['v1', 'v2', 'v3'], list(obj._deque))
+ assert_equal({'foo': 'bug'}, data)
capture = [0]
@@ -316,7 +316,7 @@ class SampleBaseTest(Chai):
spy(obj.add_to_list).spy_return(_return_spy)
obj.add_to_list('v4')
- assert_equals([0, 'v1', 'v2', 'v3', 'v4'], capture)
+ assert_equal([0, 'v1', 'v2', 'v3', 'v4'], capture)
with assert_raises(UnsupportedModifier):
spy(obj.add_to_list).times(0).returns(3)