Ejemplo n.º 1
0
def test_title_2():
    """
    Test second example title.
    :return:
    """
    # Open file
    test_file_path = os.path.join(get_module_path(), "..", "test_data", "1100644_2016-11-21")
    with open(test_file_path, "rb") as file_handle:
        # Read and parse
        file_text = file_handle.read().decode("utf-8")
        assert_list_equal(list(get_titles(file_text)),
                          ["VALIDIAN SOFTWARE LICENSE AGREEMENT"])
Ejemplo n.º 2
0
 def test_title_2(self):
     """
     Test second example title.
     """
     # Open file
     test_file_path = os.path.join(get_module_path(), '..', 'test_data',
                                   '1100644_2016-11-21')
     with codecs.open(test_file_path, 'r', encoding='utf-8') as file_handle:
         # Read and parse
         file_text = file_handle.read()
         self.assertEqual(['VALIDIAN SOFTWARE LICENSE AGREEMENT'],
                          list(get_titles(file_text)))
def test_file_3():
    """
    Test using sample file #2.
    :return:
    """
    # Open file
    base_path = get_module_path()

    with open(os.path.join(base_path, "../test_data", "1100644_2016-11-21"), "rb") as test_file_handle:
        # Read buffer
        file_buffer = test_file_handle.read().decode("utf-8")

        # Parse and count
        sections = list(lexnlp_tests.benchmark('get_sections(file_buffer)', get_sections, file_buffer))
        num_sections = len(sections)

        assert_equal(num_sections, 72)
def test_file_1():
    """
    Test using sample file #1.
    :return:
    """
    # Open file
    base_path = get_module_path()

    with codecs.open(os.path.join(base_path, "../test_data", "1582586_2015-08-31"), encoding='utf8') as test_file_handle:
        # Read buffer
        file_buffer = test_file_handle.read()

        # Parse and count
        sections = list(lexnlp_tests.benchmark('get_sections(file_buffer)', get_sections, file_buffer))
        num_sections = len(sections)

        assert_equal(num_sections, 23)
 def get_text(path):
     base_path = get_module_path()
     with open(os.path.join(base_path, "../test_data", path), "rb") as f:
         return f.read().decode("utf-8")