<commit_before>import unittest
import json
from . import unittestsetup
from .unittestsetup import environment as environment
import requests_mock


try:
    from nose_parameterized import parameterized
except:
    print("*** Please install 'nose_parameterized' to run these tests ***")
    exit(0)

import oandapyV20
from oandapyV20 import API
from oandapyV20.exceptions import V20Error
import oandapyV20.endpoints.trades as trades
from oandapyV20.endpoints.trades import responses

access_token = None
accountID = None
account_cur = None
api = None


class TestTrades(unittest.TestCase):
    """Tests regarding the trades endpoints."""

    def setUp(self):
        """setup for all tests."""
        global access_token
        global accountID
        global account_cur
        global api
        # self.maxDiff = None
        try:
            accountID, account_cur, access_token = unittestsetup.auth()
            api = API(environment=environment,
                      access_token=access_token,
                      headers={"Content-Type": "application/json"})
            api.api_url = 'https://test.com'
        except Exception as e:
            print("%s" % e)
            exit(0)

    def test__trades_base_exception(self):
        """test for the exception when using the baseclass."""
        with self.assertRaises(TypeError) as bcErr:
            r = trades.TradesList(accountID)

        bcErr = bcErr.exception
        self.assertTrue("Use of abstract base class" in "{}".format(bcErr))

    @requests_mock.Mocker()
    def test__trades_list(self, mock_get):
        """get the trades information for an account."""
        uri = 'https://test.com/v3/accounts/{}/trades'.format(accountID)
        resp = responses["_v3_accounts_accountID_trades"]['response']
        text = json.dumps(resp)
        mock_get.register_uri('GET',
                              uri,
                              text=text)
        r = trades.Trades(accountID)
        result = api.request(r)
        self.assertTrue(len(result['trades']) == 2 and
                        result['trades'][0]['instrument'] == "DE30_EUR")<commit_msg>bug fixed: correction regarding location of Trades and TradesList<commit_after>import unittest
import json
from . import unittestsetup
from .unittestsetup import environment as environment
import requests_mock


try:
    from nose_parameterized import parameterized
except:
    print("*** Please install 'nose_parameterized' to run these tests ***")
    exit(0)

import oandapyV20
from oandapyV20 import API
from oandapyV20.exceptions import V20Error
import oandapyV20.endpoints.trades as trades
from oandapyV20.endpoints.trades import responses

access_token = None
accountID = None
account_cur = None
api = None


class TestTrades(unittest.TestCase):
    """Tests regarding the trades endpoints."""

    def setUp(self):
        """setup for all tests."""
        global access_token
        global accountID
        global account_cur
        global api
        # self.maxDiff = None
        try:
            accountID, account_cur, access_token = unittestsetup.auth()
            api = API(environment=environment,
                      access_token=access_token,
                      headers={"Content-Type": "application/json"})
            api.api_url = 'https://test.com'
        except Exception as e:
            print("%s" % e)
            exit(0)

    def test__trades_base_exception(self):
        """test for the exception when using the baseclass."""
        with self.assertRaises(TypeError) as bcErr:
            r = trades.Trades(accountID)

        bcErr = bcErr.exception
        self.assertTrue("Use of abstract base class" in "{}".format(bcErr))

    @requests_mock.Mocker()
    def test__trades_list(self, mock_get):
        """get the trades information for an account."""
        uri = 'https://test.com/v3/accounts/{}/trades'.format(accountID)
        resp = responses["_v3_accounts_accountID_trades"]['response']
        text = json.dumps(resp)
        mock_get.register_uri('GET',
                              uri,
                              text=text)
        r = trades.TradesList(accountID)
        result = api.request(r)
        self.assertTrue(len(result['trades']) == 2 and
                        result['trades'][0]['instrument'] == "DE30_EUR")
{'fraction_non_alphanumeric': 0.09837962962962964, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 2.4987854251012145, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2090408', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1200, 'n_words': 311}