<commit_before>import unittest
import time
from Arduino import Arduino

"""
A collection of some basic tests for the Arduino library.

Extensive coverage is a bit difficult, since a positive test involves actually
connecting and issuing commands to a live Arduino, hosting any hardware
required to test a particular function. But a core of basic communication tests
should at least be maintained here.
"""


class TestBasics(unittest.TestCase):
    _ = raw_input('Plug in Arduino board w/LED at pin 13, reset, then press enter')
    board = Arduino('9600')

    def test_find(self):
        """
        Tests auto-connection/board detection
        """
        self.assertIsNotNone(self.board.port)

if __name__ == '__main__':
    unittest.main()<commit_msg>Add another test to explicitly connect to a serial port.<commit_after>import unittest
import time

"""
A collection of some basic tests for the Arduino library.

Extensive coverage is a bit difficult, since a positive test involves actually
connecting and issuing commands to a live Arduino, hosting any hardware
required to test a particular function. But a core of basic communication tests
should at least be maintained here.
"""


class TestBasics(unittest.TestCase):

    def test_find(self):
        """ Tests auto-connection/board detection. """
        raw_input(
            'Plug in Arduino board w/LED at pin 13, reset, then press enter')
        from Arduino import Arduino
        board = None
        try:
            # This will trigger automatic port resolution.
            board = Arduino(9600)
        finally:
            if board:
                board.close()

    def test_open(self):
        """ Tests connecting to an explicit port. """
        port = raw_input(
            'Plug in Arduino board w/LED at pin 13, reset.\n'\
            'Enter the port where the Arduino is connected, then press enter:')
        from Arduino import Arduino
        board = None
        try:
            board = Arduino(9600, port=port)
        finally:
            if board:
                board.close()

if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.07028301886792453, 'fraction_numerical': 0.008490566037735849, 'mean_word_length': 2.631849315068493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '764417', 'n_tokens_mistral': 578, 'n_tokens_neox': 538, 'n_words': 237}