def test_delete_old_oauthtoken(self):

        client = Client()

        with patch.object(GraphAPI, 'get') as graph_get:

            def side_effect(*args, **kwargs):
                if args[0] == 'oauth/access_token':
                    return TEST_GRAPH_ACCESS_TOKEN_RESPONSE
                elif args[0] == 'me':
                    return TEST_GRAPH_ME_RESPONSE

            graph_get.side_effect = side_effect

            client.get(
                path = reverse('home'),
                data = {
                    'code': TEST_AUTH_CODE
                }
            )

        assert OAuthToken.objects.count() == 1

        # Clear token from cookie so that a new token object is created,
        client.cookies['oauth_token'] = None

        with patch.object(GraphAPI, 'get') as graph_get:

            def side_effect(*args, **kwargs):
                if args[0] == 'oauth/access_token':
                    return 'second_token'
                elif args[0] == 'me':
                    return TEST_GRAPH_ME_RESPONSE

            graph_get.side_effect = side_effect

            client.get(
                path = reverse('home'),
                data = {
                    'code': TEST_AUTH_CODE
                }
            )

        assert OAuthToken.objects.count() == 1
Split the frequency distribution in two list (r, Nr), where Nr(r) > 0
dataset/ETHPy150Open jgorset/fandjango/tests/test_fandjango.py/TestFacebookWebMiddleware.test_delete_old_oauthtoken--crossover with--dataset/ETHPy150Open nltk/nltk/nltk/probability.py/SimpleGoodTuringProbDist._r_Nr