Skip to content

Commit

Permalink
Merge pull request #112 from denbeigh2000/denbeigh-fix-grammar-travesty
Browse files Browse the repository at this point in the history
Fixed questionable grammar from assertion messages
  • Loading branch information
toddsifleet committed Apr 22, 2016
2 parents eaa7b7e + 5303c23 commit 1cfa8be
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion doubles/call_count_accumulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def error_string(self):
if self.has_correct_call_count():
return ''

return '{} but was called {} {} '.format(
return '{} instead of {} {} '.format(
self._restriction_string(),
self.count,
pluralize('time', self.count)
Expand Down
12 changes: 6 additions & 6 deletions test/allow_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_fails_when_called_three_times(self):
teardown()

assert re.match(
r"Allowed 'instance_method' to be called 2 times but was called 3 times on "
r"Allowed 'instance_method' to be called 2 times instead of 3 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/allow_test.py:\d+\)",
Expand All @@ -244,7 +244,7 @@ def test_fails_when_called_two_times(self):
teardown()

assert re.match(
r"Allowed 'instance_method' to be called 1 time but was called 2 times on "
r"Allowed 'instance_method' to be called 1 time instead of 2 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/allow_test.py:\d+\)",
Expand All @@ -268,7 +268,7 @@ def test_fails_when_called_once_times(self):
teardown()

assert re.match(
r"Allowed 'instance_method' to be called 0 times but was called 1 "
r"Allowed 'instance_method' to be called 0 times instead of 1 "
r"time on <InstanceDouble of <class 'doubles.testing.User'> "
r"object at .+> with any args, but was not."
r" \(.*doubles/test/allow_test.py:\d+\)",
Expand Down Expand Up @@ -299,7 +299,7 @@ def test_called_with_zero(self):
teardown()

assert re.match(
r"Allowed 'instance_method' to be called 0 times but was called 1 "
r"Allowed 'instance_method' to be called 0 times instead of 1 "
r"time on <InstanceDouble of <class 'doubles.testing.User'> "
r"object at .+> with any args, but was not."
r" \(.*doubles/test/allow_test.py:\d+\)",
Expand Down Expand Up @@ -339,7 +339,7 @@ def test_fails_when_called_more_than_expected_times(self):
teardown()

assert re.match(
r"Allowed 'instance_method' to be called 1 time but was called 2 times on "
r"Allowed 'instance_method' to be called 1 time instead of 2 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/allow_test.py:\d+\)",
Expand Down Expand Up @@ -447,7 +447,7 @@ def test_fails_when_called_more_than_at_most_times(self):
teardown()

assert re.match(
r"Allowed 'instance_method' to be called at most 1 time but was called 2 times on "
r"Allowed 'instance_method' to be called at most 1 time instead of 2 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/allow_test.py:\d+\)",
Expand Down
20 changes: 10 additions & 10 deletions test/expect_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_fails_when_called_once(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called 2 times but was called 1 time on "
r"Expected 'instance_method' to be called 2 times instead of 1 time on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand All @@ -145,7 +145,7 @@ def test_fails_when_called_three_times(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called 2 times but was called 3 times on "
r"Expected 'instance_method' to be called 2 times instead of 3 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand All @@ -172,7 +172,7 @@ def test_fails_when_called_two_times(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called 1 time but was called 2 times on "
r"Expected 'instance_method' to be called 1 time instead of 2 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_fails_when_called_less_than_expected_times(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called 2 times but was called 1 time on "
r"Expected 'instance_method' to be called 2 times instead of 1 time on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand All @@ -232,7 +232,7 @@ def test_fails_when_called_more_than_expected_times(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called 1 time but was called 2 times on "
r"Expected 'instance_method' to be called 1 time instead of 2 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand All @@ -259,7 +259,7 @@ def test_fails_when_called_less_than_at_least_times(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called at least 2 times but was called 1 time on "
r"Expected 'instance_method' to be called at least 2 times instead of 1 time on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand Down Expand Up @@ -317,7 +317,7 @@ def test_fails_when_called_more_than_at_most_times(self):
teardown()

assert re.match(
r"Expected 'instance_method' to be called at most 1 time but was called 2 times on "
r"Expected 'instance_method' to be called at most 1 time instead of 2 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand All @@ -343,7 +343,7 @@ def test_unsatisfied_expectation(self):
teardown()

assert re.match(
r"Expected '__call__' to be called 1 time but was called 0 times on "
r"Expected '__call__' to be called 1 time instead of 0 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand Down Expand Up @@ -371,7 +371,7 @@ def test_unsatisfied_expectation(self):
teardown()

assert re.match(
r"Expected '__enter__' to be called 1 time but was called 0 times on "
r"Expected '__enter__' to be called 1 time instead of 0 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand Down Expand Up @@ -399,7 +399,7 @@ def test_unsatisfied_expectation(self):
teardown()

assert re.match(
r"Expected '__exit__' to be called 1 time but was called 0 times on "
r"Expected '__exit__' to be called 1 time instead of 0 times on "
r"<InstanceDouble of <class 'doubles.testing.User'> object at .+> "
r"with any args, but was not."
r" \(.*doubles/test/expect_test.py:\d+\)",
Expand Down
2 changes: 1 addition & 1 deletion test/pytest_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_that_should_fail_for_not_satisfying_expection():
outcomes = result.parseoutcomes()
assert outcomes['error'] == 2
expected_error = (
"*Expected 'class_method' to be called 1 time but was called 0 times on"
"*Expected 'class_method' to be called 1 time instead of 0 times on"
" <class 'doubles.testing.User'> with ('{arg_value}')*"
)
result.stdout.fnmatch_lines([expected_error.format(arg_value="test_one")])
Expand Down

0 comments on commit 1cfa8be

Please sign in to comment.