import json
import logging
import os
import unittest

import ptn


class ParseTest(unittest.TestCase):

    def test_parser(self):
        with open('files/input.json') as input_file:
            torrents = json.load(input_file)

        with open('files/output.json') as output_file:
            results = json.load(output_file)

        for torrent, result in zip(torrents, results):
            logging.info('Checking %s', torrent)
            self.assertEqual(ptn.parse(torrent), result)


if __name__ == '__main__':
    unittest.main()

import json
import os
import unittest

import ptn


class ParseTest(unittest.TestCase):

    def test_parser(self):
        with open(os.path.join(
                os.path.dirname(__file__),
                'files/input.json'
                )) as input_file:
            torrents = json.load(input_file)

        with open(os.path.join(
                os.path.dirname(__file__),
                'files/output.json'
                )) as output_file:
            expected_results = json.load(output_file)

        for torrent, expected_result in zip(torrents, expected_results):
            result = ptn.parse(torrent)
            self.assertItemsEqual(result, expected_result)


if __name__ == '__main__':
    unittest.main()

Fix minor syntax error in test
Fix minor syntax error in test

  import json
- import logging
  import os
  import unittest
  
  import ptn
  
  
  class ParseTest(unittest.TestCase):
  
      def test_parser(self):
-         with open('files/input.json') as input_file:
+         with open(os.path.join(
+                 os.path.dirname(__file__),
+                 'files/input.json'
+                 )) as input_file:
              torrents = json.load(input_file)
  
-         with open('files/output.json') as output_file:
+         with open(os.path.join(
+                 os.path.dirname(__file__),
+                 'files/output.json'
+                 )) as output_file:
-             results = json.load(output_file)
+             expected_results = json.load(output_file)
  
-         for torrent, result in zip(torrents, results):
+         for torrent, expected_result in zip(torrents, expected_results):
-             logging.info('Checking %s', torrent)
-             self.assertEqual(ptn.parse(torrent), result)
+             result = ptn.parse(torrent)
+             self.assertItemsEqual(result, expected_result)
  
  
  if __name__ == '__main__':
      unittest.main()
  
Fix minor syntax error in test
## Code Before:
import json
import logging
import os
import unittest

import ptn


class ParseTest(unittest.TestCase):

    def test_parser(self):
        with open('files/input.json') as input_file:
            torrents = json.load(input_file)

        with open('files/output.json') as output_file:
            results = json.load(output_file)

        for torrent, result in zip(torrents, results):
            logging.info('Checking %s', torrent)
            self.assertEqual(ptn.parse(torrent), result)


if __name__ == '__main__':
    unittest.main()

## Instruction:
Fix minor syntax error in test
## Code After:
import json
import os
import unittest

import ptn


class ParseTest(unittest.TestCase):

    def test_parser(self):
        with open(os.path.join(
                os.path.dirname(__file__),
                'files/input.json'
                )) as input_file:
            torrents = json.load(input_file)

        with open(os.path.join(
                os.path.dirname(__file__),
                'files/output.json'
                )) as output_file:
            expected_results = json.load(output_file)

        for torrent, expected_result in zip(torrents, expected_results):
            result = ptn.parse(torrent)
            self.assertItemsEqual(result, expected_result)


if __name__ == '__main__':
    unittest.main()
