Repository: pact-foundation/pact-python

Issue:
Suggestion: rename SomethingLike to just Like
When the SomethingLike was invented, it was a bit of a hack to help out with some brittle tests we had at REA, and I never thought it would become the standard tool it has become! In the other implementations, we're using just the name "Like" rather than "SomethingLike". It's a bit pithier. Can I suggest that you do the same for python?

Comments:

Patch:
diff --git a/README.md b/README.md
index 1a494ec..434230f 100644
--- a/README.md
+++ b/README.md
@@ -156,24 +156,25 @@ as `generate`, in this case `2016-12-15T20:16:01`. When the contract is verified
 provider, the regex will be used to search the response from the real provider service
 and the test will be considered successful if the regex finds a match in the response.
 
-### SomethingLike(matcher)
+### Like(matcher)
 Asserts the element's type matches the matcher. For example:
 
 ```python
-from pact import SomethingLike
-SomethingLike(123)  # Matches if the value is an integer
-SomethingLike('hello world')  # Matches if the value is a string
-SomethingLike(3.14)  # Matches if the value is a float
+from pact import Like
+Like(123)  # Matches if the value is an integer
+Like('hello world')  # Matches if the value is a string
+Like(3.14)  # Matches if the value is a float
 ```
-The argument supplied to `SomethingLike` will be what the mock service responds with.
+The argument supplied to `Like` will be what the mock service responds with.
 
-When a dictionary is used as an argument for SomethingLike, all the child objects (and their child objects etc.) will be matched according to their types, unless you use a more specific matcher like a Term.
+When a dictionary is used as an argument for Like, all the child objects (and their child objects etc.) will be matched according to their types, unless you use a more specific matcher like a Term.
 
 ```python
-SomethingLike({
+from pact import Like, Term
+Like({
     'username': Term('[a-zA-Z]+', 'username'),
     'id': 123, # integer
-    'confirmed': false, # boolean
+    'confirmed': False, # boolean
     'address': { # dictionary
         'street': '200 Bourke St' # string
     }
@@ -194,7 +195,7 @@ EachLike('hello')  # All items are strings
 Or other matchers can be nested inside to assert more complex objects:
 
 ```python
-from pact import EachLike, SomethingLike, Term
+from pact import EachLike, Term
 EachLike({
     'username': Term('[a-zA-Z]+', 'username'),
     'id': 123,
diff --git a/pact/__init__.py b/pact/__init__.py
index 37fe01b..31fc709 100644
--- a/pact/__init__.py
+++ b/pact/__init__.py
@@ -1,8 +1,9 @@
 """Python methods for interactive with a Pact Mock Service."""
 from .consumer import Consumer
-from .matchers import EachLike, SomethingLike, Term
+from .matchers import EachLike, Like, SomethingLike, Term
 from .pact import Pact
 from .provider import Provider
 from .__version__ import __version__  # noqa: F401
 
-__all__ = ('Consumer', 'EachLike', 'Pact', 'Provider', 'SomethingLike', 'Term')
+__all__ = ('Consumer', 'EachLike', 'Like', 'Pact', 'Provider', 'SomethingLike',
+           'Term')
diff --git a/pact/matchers.py b/pact/matchers.py
index 77d8d2e..76810c2 100644
--- a/pact/matchers.py
+++ b/pact/matchers.py
@@ -66,7 +66,7 @@ class EachLike(Matcher):
             'min': self.minimum}
 
 
-class SomethingLike(Matcher):
+class Like(Matcher):
     """
     Expect the type of the value to be the same as matcher.
 
@@ -79,7 +79,7 @@ class SomethingLike(Matcher):
     ...  .upon_receiving('a request for a random number')
     ...  .with_request('get', '/generate-number')
     ...  .will_respond_with(200, body={
-    ...    'number': SomethingLike(1111222233334444)
+    ...    'number': Like(1111222233334444)
     ...  }))
 
     Would expect the response body to be a JSON object, containing the key
@@ -120,6 +120,10 @@ class SomethingLike(Matcher):
             'contents': from_term(self.matcher)}
 
 
+# Remove SomethingLike in major version 1.0.0
+SomethingLike = Like
+
+
 class Term(Matcher):
     """
     Expect the response to match a specified regular expression.


Test patch:
diff --git a/pact/test/test_matchers.py b/pact/test/test_matchers.py
index 4d3b1ee..666991d 100644
--- a/pact/test/test_matchers.py
+++ b/pact/test/test_matchers.py
@@ -1,6 +1,6 @@
 from unittest import TestCase
 
-from ..matchers import EachLike, Matcher, SomethingLike, Term, from_term
+from ..matchers import EachLike, Like, Matcher, SomethingLike, Term, from_term
 
 
 class MatcherTestCase(TestCase):
@@ -56,6 +56,11 @@ class EachLikeTestCase(TestCase):
              'min': 1})
 
 
+class LikeTestCase(TestCase):
+    def test_is_something_like(self):
+        self.assertIs(SomethingLike, Like)
+
+
 class SomethingLikeTestCase(TestCase):
     def test_valid_types(self):
         types = [None, list(), dict(), 1, 1.0, 'string', u'unicode', Matcher()]