Пример #1
0
def step_remove_directory(context, directory):
    path_ = directory
    if not os.path.isabs(directory):
        path_ = os.path.join(context.workdir, os.path.normpath(directory))
    if os.path.isdir(path_):
        shutil.rmtree(path_, ignore_errors=True)
    assert_that(not os.path.isdir(path_))
Пример #2
0
def GetCompletions_ServerIsNotRunning_test( app ):
  StopCompleterServer( app, filetype = 'typescript' )

  filepath = PathToTestFile( 'test.ts' )
  contents = ReadFile( filepath )

  # Check that sending a request to TSServer (the response is ignored) raises
  # the proper exception.
  event_data = BuildRequest( filepath = filepath,
                             filetype = 'typescript',
                             contents = contents,
                             event_name = 'BufferVisit' )

  assert_that(
    calling( app.post_json ).with_args( '/event_notification', event_data ),
    raises( AppError, 'TSServer is not running.' ) )

  # Check that sending a command to TSServer (the response is processed) raises
  # the proper exception.
  completion_data = BuildRequest( filepath = filepath,
                                  filetype = 'typescript',
                                  contents = contents,
                                  force_semantic = True,
                                  line_num = 17,
                                  column_num = 6 )

  assert_that(
    calling( app.post_json ).with_args( '/completions', completion_data ),
    raises( AppError, 'TSServer is not running.' ) )
Пример #3
0
 def test_queries_for_hour_period_spanning_less_than_seven_days_are_allowed(self):
     validation_result = validate_request_args({
         'period': 'hour',
         'start_at': '2000-02-02T00:00:00+00:00',
         'end_at': '2000-02-08T00:00:00+00:00'
     }, False)
     assert_that(validation_result, is_valid())
Пример #4
0
def GetCompletions_IgoreNonJSFiles_test(app):
    trivial1 = {"filetypes": ["python"], "contents": ReadFile(PathToTestFile("trivial.js"))}
    trivial2 = {"filetypes": ["javascript"], "contents": ReadFile(PathToTestFile("trivial2.js"))}

    request = {
        "line_num": 1,
        "column_num": 3,
        "file_data": {PathToTestFile("trivial.js"): trivial1, PathToTestFile("trivial2.js"): trivial2},
    }

    app.post_json(
        "/event_notification",
        _Merge(request, {"filepath": PathToTestFile("trivial2.js"), "event_name": "FileReadyToParse"}),
    )

    response = app.post_json("/completions", _Merge(request, {"filepath": PathToTestFile("trivial2.js")})).json

    print("completer response: {0}".format(pformat(response, indent=2)))

    assert_that(
        response,
        has_entries(
            {
                "completion_start_column": 3,
                # Note: we do *not* see X.y and X.z because tern is not told about
                # the trivial.js file because we pretended it was Python
                "completions": empty(),
                "errors": empty(),
            }
        ),
    )
Пример #5
0
def GetCompletions_AfterRestart_test( app ):
  filepath = PathToTestFile( 'test.ts' )

  app.post_json( '/run_completer_command',
                BuildRequest( completer_target = 'filetype_default',
                              command_arguments = [ 'RestartServer' ],
                              filetype = 'typescript',
                              filepath = filepath ) )

  completion_data = BuildRequest( filepath = filepath,
                                  filetype = 'typescript',
                                  contents = ReadFile( filepath ),
                                  force_semantic = True,
                                  line_num = 17,
                                  column_num = 6 )

  response = app.post_json( '/completions', completion_data )
  assert_that( response.json, has_entries( {
        'completions': contains_inanyorder(
          CompletionEntryMatcher( 'methodA', extra_params = {
            'menu_text': 'methodA (method) Foo.methodA(): void' } ),
          CompletionEntryMatcher( 'methodB', extra_params = {
            'menu_text': 'methodB (method) Foo.methodB(): void' } ),
          CompletionEntryMatcher( 'methodC', extra_params = {
            'menu_text': ( 'methodC (method) Foo.methodC(a: '
                           '{ foo: string; bar: number; }): void' ) } ),
        )
      } ) )
Пример #6
0
 def test_queries_with_dates_at_beginning_of_day_are_allowed(self):
     validation_result = validate_request_args({
         'period': 'day',
         'start_at': '2000-02-02T00:00:00+00:00',
         'end_at': '2000-02-19T00:00:00+00:00'
     }, False)
     assert_that(validation_result, is_valid())
Пример #7
0
 def test_queries_for_hour_period_with_dates_at_middle_of_day_are_allowed(self):
     validation_result = validate_request_args({
         'period': 'hour',
         'start_at': '2000-02-02T12:00:00+00:00',
         'end_at': '2000-02-19T13:00:00+00:00'
     }, False)
     assert_that(validation_result, is_valid())
Пример #8
0
    def test_period_with_just_positive_duration(self):
        validation_result = validate_request_args({
            'period': 'day',
            'duration': '3',
        })

        assert_that(validation_result, is_valid())
Пример #9
0
    def test_just_end_at_isnt_allowed(self):
        validation_result = validate_request_args({
            'end_at': '2000-02-02T00:00:00+00:00',
        })

        assert_that(validation_result, is_invalid_with_message(
            "Use of 'end_at' requires 'start_at' or 'duration'"))
Пример #10
0
 def test_queries_sorting_by_invalid_field_names_are_disallowed(self):
     validation_result = validate_request_args({
         'sort_by': 'with-hyphen:ascending'
     })
     assert_that(validation_result, is_invalid_with_message(
         'Cannot sort by an invalid field name'
     ))
Пример #11
0
 def test_that_inclusive_queries(self):
     validation_result = validate_request_args({
         'inclusive': 'true',
         'start_at': '2012-12-01T00:00:00Z',
         'end_at': '2012-12-01T00:00:00Z',
     })
     assert_that(validation_result, is_valid())
Пример #12
0
 def test_queries_with_grouping_on_internal_fields_are_disallowed(self):
     validation_result = validate_request_args({
         "group_by": "_internal"
     })
     assert_that(validation_result, is_invalid_with_message(
         "Cannot group by internal fields, internal fields "
         "start with an underscore"))
Пример #13
0
 def test_queries_with_unrecognized_sort_by_values_are_disallowed(self):
     validation_result = validate_request_args({
         'sort_by': 'foo:random',
     })
     assert_that( validation_result, is_invalid_with_message(
         'Unrecognised sort direction. Supported directions '
         'include: ascending, descending') )
Пример #14
0
 def test_filter_by_prefix_with_invalid_field_names_is_disallowed(self):
     validation_result = validate_request_args({
         'filter_by_prefix': 'with-hyphen:bar'
     })
     assert_that(validation_result, is_invalid_with_message(
         'Cannot filter by an invalid field name'
     ))
Пример #15
0
 def test_queries_with_will_formatted_starts_and_ends_are_allowed(self):
     validation_result = validate_request_args({
         'period': 'week',
         'start_at': '2010-01-01T00:10:10+00:00',
         'end_at': '2010-01-07T00:10:10+00:00',
     })
     assert_that( validation_result, is_valid() )
    def test_find_virtual_disk(self):
        spec = vim.vm.ConfigSpec()
        vm_config = self.vm_config
        devices = self.dummy_devices()
        for device in devices:
            vm_config.add_device(spec, device)
        cfg_info = FakeConfigInfo()
        device_type = vim.vm.device.VirtualDisk
        datastore = "ds1"
        filename = "folder/foo"
        path = vmdk_path(datastore, filename)

        find_disk = vm_config.disk_matcher(datastore, filename)
        disk = vm_config.find_device(devices, device_type, matcher=find_disk)
        assert_that(disk, equal_to(None))

        vm_config.add_scsi_disk(cfg_info, spec, datastore, "nope")

        self.assertRaises(DeviceNotFoundException, vm_config.get_device,
                          devices, device_type, matcher=find_disk)

        vm_config.add_scsi_disk(cfg_info, spec, datastore,
                                filename)
        device_changes = spec.deviceChange
        device_list = []
        for device_change in device_changes:
            device_list.append(device_change.device)

        disk = vm_config.find_device(device_list, device_type,
                                     matcher=find_disk)
        assert_that(disk.backing.fileName, equal_to(path))
def RawResponse_ConvertedFromOmniCompleter_test():
  vim_results = [
    { "word": "WORD", "abbr": "ABBR", "menu": "MENU",
      "kind": "KIND", "info": "INFO" },
    { "word": "WORD2", "abbr": "ABBR2", "menu": "MENU2",
      "kind": "KIND2", "info": "INFO" },
    { "word": "WORD", "abbr": "ABBR",  },
    {  },
  ]
  expected_results = [
    has_entries( { "insertion_text": "WORD", "menu_text": "ABBR",
                   "extra_menu_info": "MENU", "kind": [ "KIND" ],
                   "detailed_info": "INFO" } ),
    has_entries( { "insertion_text": "WORD2", "menu_text": "ABBR2",
                   "extra_menu_info": "MENU2", "kind": [ "KIND2" ],
                   "detailed_info": "INFO" } ),
    has_entries( { "insertion_text": "WORD", "menu_text": "ABBR",  } ),
    has_entries( {  } ),
  ]
  request = BuildOmnicompletionRequest( vim_results )

  results = request.RawResponse()

  eq_( len( results ), len( expected_results ) )
  for result, expected_result in zip( results, expected_results ):
    assert_that( result, expected_result )
Пример #18
0
 def test_create_lun_with_muitl_property(self):
     pool = UnityPool(_id='pool_1', cli=t_rest())
     lun = pool.create_lun("LunName", 100,
                           description="Hello World", is_thin=True,
                           is_repl_dst=True,
                           tiering_policy=TieringPolicyEnum.AUTOTIER_HIGH)
     assert_that(lun, instance_of(UnityLun))
Пример #19
0
def test_calls_subscribed(broker, listener):
    event = "test"
    sentinel = object()
    broker.subscribe(event, listener.test_cb)
    broker.publish(event, s=sentinel)

    assert_that(listener.test_cb, called_once_with(s=sentinel))
Пример #20
0
    def test_encode_list(self):
        call_log_1 = {
            'Call Date': '01/30/2013 00:00:00',
            'Caller': 'source1 (1001)',
            'Called': '2001',
            'Period': '1',
            'user Field': ''
        }

        call_log_2 = {
            'Call Date': '01/31/2013 00:00:00',
            'Caller': u'soùrce2 (1002)',
            'Called': '2002',
            'Period': '2',
            'user Field': 'userfield'
        }
        call_logs = [call_log_1, call_log_2]
        expected_result = textwrap.dedent('''\
            %s\r
            01/30/2013 00:00:00,source1 (1001),2001,1,\r
            01/31/2013 00:00:00,soùrce2 (1002),2002,2,userfield\r
            ''' % ','.join(CSV_HEADERS))

        result = serializer.encode_list(call_logs)

        assert_that(result, equal_to(expected_result))
Пример #21
0
 def test_create_filesystem_success(self):
     pool = UnityPool(_id='pool_1', cli=t_rest())
     fs = pool.create_filesystem(
         'nas_2', 'fs3', 3 * 1024 ** 3,
         proto=FSSupportedProtocolEnum.CIFS,
         tiering_policy=TieringPolicyEnum.AUTOTIER_HIGH)
     assert_that(fs.get_id(), equal_to('fs_12'))
    def test_it_offers_a_way_to_mark_a_goal(self):
        self.browser.visit("http://localhost:{port}/#new_goal".format(port=CLIENT_SERVER_PORT))
        self.browser.fill("scoredBy", "23")
        self.browser.fill("assistedBy", "10")
        self.browser.find_by_id('markGoal').click()

        assert_that(self.browser.find_by_id("message").text, equal_to("Goal marked"))
Пример #23
0
def test_moves_track_of_album():
    chevere = build.track(track_title="Chevere!")
    salsa_coltrane = build.track(track_title="Salsa Coltrane")
    honeycomb = build.album(tracks=[salsa_coltrane, chevere])

    director.move_track_of(honeycomb)(0, 1)
    assert_that(honeycomb.tracks, contains(chevere, salsa_coltrane), "reordered tracks")
Пример #24
0
def GetCompletions_ClangCompleter_ForceSemantic_OnlyFileteredCompletions_test():
  app = TestApp( handlers.app )
  contents = """
int main()
{
  int foobar;
  int floozar;
  int gooboo;
  int bleble;

  fooar
}
"""

  # 0-based line and column!
  completion_data = BuildRequest( filepath = '/foo.cpp',
                                  filetype = 'cpp',
                                  force_semantic = True,
                                  contents = contents,
                                  line_num = 8,
                                  column_num = 7,
                                  start_column = 7,
                                  query = 'fooar',
                                  compilation_flags = ['-x', 'c++'] )

  results = app.post_json( '/completions', completion_data ).json
  assert_that( results,
               contains_inanyorder( CompletionEntryMatcher( 'foobar' ),
                                    CompletionEntryMatcher( 'floozar' ) ) )
Пример #25
0
def test_ignores_invalid_tracks(track_catalog):
    valid_track = track_catalog.add_track("valid.mp3")

    album = build.album()
    director.add_tracks(album, "invalid.mp3", "valid.mp3", from_catalog=track_catalog)

    assert_that(album.tracks, contains(valid_track), "valid tracks in album")
Пример #26
0
 def edit(self, config):
     result = self.nc.edit_config(target="candidate", config=dict_2_etree({
         "config": {
             "configuration": config
         }
     }))
     assert_that(result.xpath("//rpc-reply/ok"), has_length(1))
Пример #27
0
def GetCompletions_ClangCompleter_WorksWithExplicitFlags_test():
  app = TestApp( handlers.app )
  contents = """
struct Foo {
  int x;
  int y;
  char c;
};

int main()
{
  Foo foo;
  foo.
}
"""

  # 0-based line and column!
  completion_data = BuildRequest( filepath = '/foo.cpp',
                                  filetype = 'cpp',
                                  contents = contents,
                                  line_num = 10,
                                  column_num = 6,
                                  start_column = 6,
                                  compilation_flags = ['-x', 'c++'] )

  results = app.post_json( '/completions', completion_data ).json
  assert_that( results, has_items( CompletionEntryMatcher( 'c' ),
                                   CompletionEntryMatcher( 'x' ),
                                   CompletionEntryMatcher( 'y' ) ) )
Пример #28
0
def test_adds_selected_tracks_to_album_in_order(track_catalog):
    tracks = [track_catalog.add_track(filename) for filename in ("first.mp3", "second.mp3", "third.mp3")]

    album = build.album()
    director.add_tracks(album, "first.mp3", "second.mp3", "third.mp3", from_catalog=track_catalog)

    assert_that(album.tracks, contains(*tracks), "tracks added to album")
Пример #29
0
def RunTest(app, test):
    """
  Method to run a simple completion test and verify the result

  test is a dictionary containing:
    'request': kwargs for BuildRequest
    'expect': {
       'response': server response code (e.g. httplib.OK)
       'data': matcher for the server response json
    }
  """

    contents = ReadFile(test["request"]["filepath"])

    app.post_json(
        "/event_notification",
        _CombineRequest(test["request"], {"event_name": "FileReadyToParse", "contents": contents}),
        expect_errors=True,
    )

    # We ignore errors here and we check the response code ourself.
    # This is to allow testing of requests returning errors.
    response = app.post_json(
        "/completions", _CombineRequest(test["request"], {"contents": contents}), expect_errors=True
    )

    print("completer response: {0}".format(pformat(response.json)))

    eq_(response.status_code, test["expect"]["response"])

    assert_that(response.json, test["expect"]["data"])
Пример #30
0
 def _check_that(actual, expected):
     try:
         hamcrest.assert_that(actual, expected)
     except AssertionError as ex:
         msg = ex.args[0]
         return False, msg
     return True, None
Пример #31
0
def step_then_no_colors_are_used(context):
    assert_that(context.used_colors, has_length(0))
Пример #32
0
 def test_unit(self, sample_merch):
     item = create_merch()
     assert_that(item.unit, is_("szt."))
     item.by_meter = True
     assert_that(item.unit, is_("m.b."))
Пример #33
0
 def test_not_eq(self, sample_merch):
     other = create_merch(2)
     assert_that(sample_merch == other, is_(False))
Пример #34
0
 def test_eq(self, sample_merch):
     other = create_merch(1)
     assert_that(sample_merch == other, is_(True))
Пример #35
0
    def test_reset(self, create_merchandise_dialog):
        create_merchandise_dialog.line_edit_code.insert("sample code")
        create_merchandise_dialog.line_edit_description.insert(
            "sample description")
        create_merchandise_dialog.radio_button_metre.setChecked(True)
        create_merchandise_dialog.line_edit_discount_group.insert(
            "sample discount group")
        create_merchandise_dialog.spin_box_price.setValue(9.99)

        create_merchandise_dialog.reset()

        assert_that(create_merchandise_dialog.line_edit_code.text(),
                    is_(empty()))
        assert_that(create_merchandise_dialog.line_edit_description.text(),
                    is_(empty()))
        assert_that(create_merchandise_dialog.radio_button_metre,
                    is_(unchecked()))
        assert_that(create_merchandise_dialog.radio_button_piece,
                    is_(checked()))
        assert_that(create_merchandise_dialog.line_edit_discount_group.text(),
                    is_(empty()))
        assert_that(create_merchandise_dialog.spin_box_price.value(), is_(0.0))
Пример #36
0
    def test_initial_state(self, create_merchandise_dialog, sample_groups):
        # todo: other translations
        assert_that(create_merchandise_dialog.windowTitle(),
                    is_("Create merchandise"))

        model = create_merchandise_dialog.line_edit_discount_group.completer(
        ).completionModel()
        assert_that(
            model.match(model.index(0, 0), Qt.DisplayRole, sample_groups[0]))
        assert_that(
            model.match(model.index(1, 0), Qt.DisplayRole, sample_groups[1]))

        assert_that(create_merchandise_dialog.line_edit_code.text(),
                    is_(empty()))
        assert_that(create_merchandise_dialog.line_edit_description.text(),
                    is_(empty()))
        assert_that(create_merchandise_dialog.radio_button_metre,
                    is_(unchecked()))
        assert_that(create_merchandise_dialog.radio_button_piece,
                    is_(checked()))
        assert_that(create_merchandise_dialog.line_edit_discount_group.text(),
                    is_(empty()))
        assert_that(create_merchandise_dialog.spin_box_price.decimals(),
                    is_(2))
        assert_that(create_merchandise_dialog.spin_box_price.minimum(),
                    is_(0.0))
        assert_that(create_merchandise_dialog.spin_box_price.singleStep(),
                    is_(1.0))
        assert_that(create_merchandise_dialog.spin_box_price.maximum(),
                    is_(100000.0))
        assert_that(create_merchandise_dialog.spin_box_price.value(), is_(0.0))
Пример #37
0
def step_then_following_colors_are_used(context):
    assert context.table, "table<color> is required"
    used_colors = sorted(context.used_colors)
    expected_colors = [row[0] for row in context.table]
    # -- LIST-COMPARISON:
    assert_that(used_colors, contains(*sorted(expected_colors)))
Пример #38
0
 def test_it_can_construct_default_core_props(self):
     core_props = CoreProperties.default()
     # verify -----------------------
     assert_that(core_props, is_(instance_of(CoreProperties)))
     assert_that(core_props.content_type, is_(CT.OPC_CORE_PROPERTIES))
     assert_that(core_props.partname, is_('/docProps/core.xml'))
     assert_that(core_props._element, is_(instance_of(CT_CoreProperties)))
     assert_that(core_props.title, is_('PowerPoint Presentation'))
     assert_that(core_props.last_modified_by, is_('python-pptx'))
     assert_that(core_props.revision, is_(1))
     # core_props.modified only stores time with seconds resolution, so
     # comparison needs to be a little loose (within two seconds)
     modified_timedelta = datetime.utcnow() - core_props.modified
     max_expected_timedelta = timedelta(seconds=2)
     assert_that(modified_timedelta, less_than(max_expected_timedelta))
Пример #39
0
def step_impl(context):
    global GLOBAL_TIMESTAMP
    while not GLOBAL_TIMESTAMP:
        time.sleep(1)
    assert_that(context.msg.header.timestamp, equal_to(GLOBAL_TIMESTAMP))
Пример #40
0
    def test_list(self, token_1, token_2, tenant_uuid):
        result = self._session_dao.list_()
        assert_that(
            result,
            contains_inanyorder(
                has_entries(
                    uuid=token_1['session_uuid'],
                    user_uuid=token_1['auth_id'],
                    tenant_uuid=tenant_uuid,
                ),
                has_entries(uuid=token_2['session_uuid'], user_uuid=token_2['auth_id']),
            ),
        )

        result = self._session_dao.list_(tenant_uuids=[TENANT_UUID_1])
        assert_that(
            result, contains_inanyorder(has_entries(uuid=token_1['session_uuid']))
        )

        result = self._session_dao.list_(tenant_uuids=[])
        assert_that(result, empty())

        result = self._session_dao.list_(order='mobile', direction='desc')
        assert_that(
            result,
            contains(
                has_entries(uuid=token_1['session_uuid']),
                has_entries(uuid=token_2['session_uuid']),
            ),
        )

        result = self._session_dao.list_(order='mobile', direction='asc', limit=1)
        assert_that(result, contains(has_entries(uuid=token_2['session_uuid'])))

        result = self._session_dao.list_(order='mobile', direction='asc', offset=1)
        assert_that(result, contains(has_entries(uuid=token_1['session_uuid'])))

        result = self._session_dao.list_(user_uuid=token_1['auth_id'])
        assert_that(result, contains(has_entries(uuid=token_1['session_uuid'])))
def step_impl(context, exceptions):
    assert_that(context.exceptions, is_(exceptions))
Пример #42
0
def check_normal_resp_base_info(context):
    """
    只校验code为0000
    """
    assert_that(context.data['code'], equal_to(str(RESP_CODE_ENUM.SUCCESS)),
                "返回正常报文,code应该为0000")
def step_impl(context, leader_name):
    assert_that(str(context.leader_allotype), is_(leader_name))
def step_impl(context, unknowns):
    assert_that(context.unknowns, is_(unknowns))
Пример #45
0
    def test_given_no_rabbitmq_when_status_then_rabbitmq_fail(self):
        result = self.calld.status()

        assert_that(result['bus_consumer']['status'], equal_to('fail'))
def step_impl(context, known):
    assert_that(str(context.known), is_(known))
Пример #47
0
    def test_given_no_ari_when_status_then_ari_fail(self):
        result = self.calld.status()

        assert_that(result['ari']['status'], equal_to('fail'))
Пример #48
0
 def rabbitmq_is_down():
     result = self.calld.status()
     assert_that(result['bus_consumer']['status'], equal_to('fail'))
Пример #49
0
def CompatibleWithCurrentCore_Compatible_test( logger ):
  assert_that( CompatibleWithCurrentCore(), equal_to( 0 ) )
  assert_that( logger.method_calls, empty() )
Пример #50
0
 def ari_is_down():
     result = self.calld.status()
     assert_that(result['ari']['status'], equal_to('fail'))
Пример #51
0
def GetStandardLibraryIndexInSysPath_ErrorIfNoStandardLibrary_test( *args ):
  assert_that(
    calling( GetStandardLibraryIndexInSysPath ),
    raises( RuntimeError,
            'Could not find standard library path in Python path.' ) )
Пример #52
0
def assert_bits(context):
    assert_that(context.outcome,
                is_(close_to(value=context.expected, delta=DELTA)))
    assert_that(context.reverse_outcome,
                is_(close_to(value=context.source, delta=DELTA)))
    return
Пример #53
0
def AddNearestThirdPartyFoldersToSysPath_Failure_test():
  assert_that(
    calling( AddNearestThirdPartyFoldersToSysPath ).with_args(
      os.path.expanduser( '~' ) ),
    raises( RuntimeError, '.*third_party folder.*' ) )
Пример #54
0
def GetStandardLibraryIndexInSysPath_FindEmbeddedStandardLibrary_test( *args ):
  assert_that( GetStandardLibraryIndexInSysPath(), equal_to( 1 ) )
    def test_parse_empty_csv(self):
        csv_stream = _string_io("")

        data = _traverse(parse_csv(csv_stream))

        assert_that(data, is_([]))
Пример #56
0
def AddNearestThirdPartyFoldersToSysPath_ErrorIfNoStandardLibrary_test( *args ):
  assert_that(
    calling( AddNearestThirdPartyFoldersToSysPath ).with_args( __file__ ),
    raises( RuntimeError,
            'Could not find standard library path in Python path.' ) )
    def test_handles_emptylines(self):
        text = "q\n\rw\r\r\ne"

        lines_list = list(lines(_string_io(text)))

        assert_that(lines_list, is_(["q\n", "\r", "w\r", "\r\n", "e"]))
Пример #58
0
def CompatibleWithCurrentCore_Outdated_NoVersionMatch_test( logger, *args ):
  assert_that( CompatibleWithCurrentCore(), equal_to( 7 ) )
  assert_that( logger.method_calls, has_length( 1 ) )
  logger.error.assert_called_with(
    'ycm_core library too old; PLEASE RECOMPILE by running the build.py '
    'script. See the documentation for more details.' )
    def test_handles_CR_LF_and_CRLF(self):
        text = "1\n2\r3\r\n4"

        lines_list = list(lines(_string_io(text)))

        assert_that(lines_list, is_(["1\n", "2\r", "3\r\n", "4"]))
    def test_ignores_trailing_empty_line(self):
        text = "asd\n"

        lines_list = list(lines(_string_io(text)))

        assert_that(lines_list, is_(["asd\n"]))