Skip to content

Commit

Permalink
fixed the grammar of 'have_same_attributes_values_as' matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascamata committed Jul 8, 2011
1 parent ba96a4e commit 5fbe90c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@

Simple test

>>> a |should| have_same_attributes_values_as(b)
>>> a |should| have_same_attribute_values_as(b)

>>> a |should| have_same_attributes_values_as(c)
>>> a |should| have_same_attribute_values_as(c)
Traceback (most recent call last):
...
ShouldNotSatisfied: expected <...Foo ... at ...> to have the same attributes as <...Foo ... at ...>
ShouldNotSatisfied: expected <...Foo ... at ...> to have the same attribute values as <...Foo ... at ...>

>>> a |should_not| have_same_attributes_values_as(b)
>>> a |should_not| have_same_attribute_values_as(b)
Traceback (most recent call last):
...
ShouldNotSatisfied: expected <...Foo ... at ...> to have not the same attributes as <...Foo ... at ...>
ShouldNotSatisfied: expected <...Foo ... at ...> to have not the same attribute values as <...Foo ... at ...>

Adding attributes to each object

>>> a.c = 3
>>> b.c = 3

>>> a |should| have_same_attributes_values_as(b)
>>> a |should| have_same_attribute_values_as(b)

Deleting one attribute of the object

>>> del a.c


>>> a |should_not| have_same_attributes_values_as(b)
>>> a |should_not| have_same_attribute_values_as(b)
10 changes: 5 additions & 5 deletions should_dsl/matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,9 @@ def message_for_failed_should_not(self):

matcher(BeEmpty)

class HaveSameAttributesValues(object):
class HaveSameAttributeValues(object):

name = 'have_same_attributes_values_as'
name = 'have_same_attribute_values_as'

def __call__(self, other_object):
self._other_object = other_object
Expand All @@ -690,9 +690,9 @@ def match(self, actual_object):
return found_different_attribute == False

def message_for_failed_should(self):
return "expected %r to have the same attributes as %r" % (self._actual_object, self._other_object)
return "expected %r to have the same attribute values as %r" % (self._actual_object, self._other_object)

def message_for_failed_should_not(self):
return "expected %r to have not the same attributes as %r" % (self._actual_object, self._other_object)
return "expected %r to have not the same attribute values as %r" % (self._actual_object, self._other_object)

matcher(HaveSameAttributesValues)
matcher(HaveSameAttributeValues)

0 comments on commit 5fbe90c

Please sign in to comment.