Пример #1
0
 def __init__(self, client):
     """
     Initializes a new GroupsAPI that will use the given client object
     to make HTTP requests.
     """
     self._client = client
     self._argument_converter = ArgumentConverter(
         none_filter, stringify_booleans,
     )
Пример #2
0
 def __init__(self, client):
     """
     Initializes a new RelationshipsAPI that will use the given ``client`` object
     to make HTTP requests.
     """
     self._client = client
     self._argument_converter = ArgumentConverter(
         IDExtractor(r"^(older|newer)_than|.*_id$"),
         flatten_lists,
         flatten_dicts,
         stringify_booleans,
         none_filter,
     )
Пример #3
0
    def test_using_a_custom_regular_expression(self):
        converter = ArgumentConverter(IDExtractor(r'^(older|newer)_than$'))
        result = converter(
            older_than={"id": 1},
            newer_than={"id": 2},
            older_or_newer_than={"id": 3},
            message_id={"id": 4},
        )

        self.assertEquals(1, result["older_than"])
        self.assertEquals(2, result["newer_than"])
        self.assertEquals({"id": 3}, result["older_or_newer_than"])
        self.assertEquals({"id": 4}, result["message_id"])
Пример #4
0
 def __init__(self, client):
     """
     Initializes a new UsersAPI that will use the given client object
     to make HTTP requests.
     """
     self._client = client
     self._argument_converter = ArgumentConverter(
         education_argument_converter,
         previous_companies_argument_converter,
         flatten_dicts,
         stringify_booleans,
         none_filter,
     )
Пример #5
0
 def setUp(self):
     self.converter = ArgumentConverter(flatten_lists)
Пример #6
0
 def setUp(self):
     self.converter = ArgumentConverter()
Пример #7
0
 def setUp(self):
     self.converter = ArgumentConverter(
         flatten_dicts,
         flatten_lists,
         none_filter,
     )
Пример #8
0
 def setUp(self):
     self.converter = ArgumentConverter(none_filter)
Пример #9
0
 def setUp(self):
     self.converter = ArgumentConverter(IDExtractor())
Пример #10
0
 def setUp(self):
     self.converter = ArgumentConverter(stringify_booleans)