예제 #1
0
def MatchesSemanticTrigger_RegexTrigger_test():
    ok_(
        cu._MatchesSemanticTrigger('foo.bar', 4,
                                   [cu._PrepareTrigger(r're!\w+\.')]))

    ok_(not cu._MatchesSemanticTrigger('foo . bar', 5,
                                       [cu._PrepareTrigger(r're!\w+\.')]))
예제 #2
0
def MatchesSemanticTrigger_RegexTrigger_test():
  ok_( cu._MatchesSemanticTrigger( 'foo.bar',
                                   4,
                                   [ cu._PrepareTrigger( r're!\w+\.' ) ] ) )

  ok_( not cu._MatchesSemanticTrigger( 'foo . bar',
                                       5,
                                       [ cu._PrepareTrigger( r're!\w+\.' ) ] ) )
예제 #3
0
def MatchesSemanticTrigger_OneTriggerMatches_test():
    ok_(
        cu._MatchesSemanticTrigger('foo::bar', 5, [
            cu._PrepareTrigger('.'),
            cu._PrepareTrigger(';'),
            cu._PrepareTrigger('::')
        ]))
예제 #4
0
def MatchesSemanticTrigger_OneTriggerMatches_test():
    triggers = [
        cu._PrepareTrigger('.'),
        cu._PrepareTrigger(';'),
        cu._PrepareTrigger('::')
    ]

    assert_that(cu._MatchesSemanticTrigger('foo::bar', 5, 8, triggers))
예제 #5
0
def MatchesSemanticTrigger_Basic_test():
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 7, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 6, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 5, ['.'] ) )

  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 4, ['.'] ) )

  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 3, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 2, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 1, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 0, ['.'] ) )
예제 #6
0
def MatchesSemanticTrigger_BadInput_test():
    triggers = [cu._PrepareTrigger('.')]

    ok_(not cu._MatchesSemanticTrigger('foo.bar', 10, 7, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', -1, 7, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 4, -1, triggers))
    ok_(not cu._MatchesSemanticTrigger('', -1, 0, triggers))
    ok_(not cu._MatchesSemanticTrigger('', 0, 0, triggers))
    ok_(not cu._MatchesSemanticTrigger('', 1, 0, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 4, 7, []))
예제 #7
0
def MatchesSemanticTrigger_BadInput_test():
  triggers = [ cu._PrepareTrigger( '.' ) ]

  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 10, 7, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', -1, 7, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 4, -1, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( '', -1, 0, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( '', 0, 0, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( '', 1, 0, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 4, 7, [] ) )
예제 #8
0
def MatchesSemanticTrigger_BadInput_test():
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 10, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', -1, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( '', -1, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( '', 0, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( '', 1, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 4, [] ) )
예제 #9
0
def MatchesSemanticTrigger_LongerTrigger_test():
    triggers = [cu._PrepareTrigger('::')]

    ok_(not cu._MatchesSemanticTrigger('foo::bar', 6, 8, triggers))
    ok_(cu._MatchesSemanticTrigger('foo::bar', 5, 8, triggers))
    ok_(cu._MatchesSemanticTrigger('foo::bar', 4, 8, triggers))
    ok_(cu._MatchesSemanticTrigger('foo::bar', 3, 8, triggers))

    ok_(not cu._MatchesSemanticTrigger('foo::bar', 4, 4, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo::bar', 3, 4, triggers))
예제 #10
0
def MatchesSemanticTrigger_LongerTrigger_test():
  triggers = [ cu._PrepareTrigger( '::' ) ]

  ok_( not cu._MatchesSemanticTrigger( 'foo::bar', 6, 8, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo::bar', 5, 8, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo::bar', 4, 8, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo::bar', 3, 8, triggers ) )

  ok_( not cu._MatchesSemanticTrigger( 'foo::bar', 4, 4, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo::bar', 3, 4, triggers ) )
예제 #11
0
def MatchesSemanticTrigger_LongerTrigger_test():
  ok_( cu._MatchesSemanticTrigger( 'foo::bar', 5, ['::'] ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo::bar', 4, ['::'] ) )
예제 #12
0
def MatchesSemanticTrigger_TriggerIsWrong_test():
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 4, [':'] ) )
예제 #13
0
def MatchesSemanticTrigger_TriggerIsWrong_test():
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 4, [cu._PrepareTrigger(':')])
        )
예제 #14
0
def MatchesSemanticTrigger_TriggerBetweenWords_test():
  ok_( cu._MatchesSemanticTrigger( 'foo . bar', 5, ['.'] ) )
예제 #15
0
def MatchesSemanticTrigger_TriggerBetweenWords_test():
  triggers = [ cu._PrepareTrigger( '.' ) ]

  ok_( not cu._MatchesSemanticTrigger( 'foo . bar', 6, 9, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo . bar', 5, 9, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo . bar', 4, 9, triggers ) )
예제 #16
0
def MatchesSemanticTrigger_TriggerIsWrong_test():
    triggers = [cu._PrepareTrigger(':')]

    ok_(not cu._MatchesSemanticTrigger('foo.bar', 4, 7, triggers))
예제 #17
0
def MatchesSemanticTrigger_TriggerBetweenWords_test():
    triggers = [cu._PrepareTrigger('.')]

    ok_(not cu._MatchesSemanticTrigger('foo . bar', 6, 9, triggers))
    ok_(cu._MatchesSemanticTrigger('foo . bar', 5, 9, triggers))
    ok_(cu._MatchesSemanticTrigger('foo . bar', 4, 9, triggers))
예제 #18
0
def MatchesSemanticTrigger_TriggerIsWrong_test():
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 4, [cu._PrepareTrigger( ':' )] ) )
예제 #19
0
def MatchesSemanticTrigger_JustTrigger_test():
    ok_(cu._MatchesSemanticTrigger('.', 1, [cu._PrepareTrigger('.')]))
    ok_(not cu._MatchesSemanticTrigger('.', 0, [cu._PrepareTrigger('.')]))
예제 #20
0
def MatchesSemanticTrigger_RegexTrigger_test():
    triggers = [cu._PrepareTrigger(r're!\w+\.')]

    ok_(cu._MatchesSemanticTrigger('foo.bar', 4, 8, triggers))

    ok_(not cu._MatchesSemanticTrigger('foo . bar', 5, 8, triggers))
예제 #21
0
def MatchesSemanticTrigger_OneTriggerMatches_test():
  triggers = [ cu._PrepareTrigger( '.' ),
               cu._PrepareTrigger( ';' ),
               cu._PrepareTrigger( '::' ) ]

  ok_( cu._MatchesSemanticTrigger( 'foo::bar', 5, 8, triggers ) )
예제 #22
0
def MatchesSemanticTrigger_TriggerIsWrong_test():
  triggers = [ cu._PrepareTrigger( ':' ) ]

  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 4, 7, triggers ) )
예제 #23
0
def MatchesSemanticTrigger_JustTrigger_test():
  triggers = [ cu._PrepareTrigger( '.' ) ]

  assert_that( not cu._MatchesSemanticTrigger( '.', 2, 2, triggers ) )
  assert_that( cu._MatchesSemanticTrigger( '.', 1, 1, triggers ) )
  assert_that( not cu._MatchesSemanticTrigger( '.', 0, 0, triggers ) )
예제 #24
0
def MatchesSemanticTrigger_OneTriggerMatches_test():
  ok_( cu._MatchesSemanticTrigger( 'foo::bar', 5, ['.', ';', '::'] ) )
예제 #25
0
def MatchesSemanticTrigger_TriggerBetweenWords_test():
  ok_( cu._MatchesSemanticTrigger( 'foo . bar', 5, [cu._PrepareTrigger( '.' )] ) )
예제 #26
0
def MatchesSemanticTrigger_JustTrigger_test():
    triggers = [cu._PrepareTrigger('.')]

    ok_(not cu._MatchesSemanticTrigger('.', 2, 2, triggers))
    ok_(cu._MatchesSemanticTrigger('.', 1, 1, triggers))
    ok_(not cu._MatchesSemanticTrigger('.', 0, 0, triggers))
예제 #27
0
def MatchesSemanticTrigger_JustTrigger_test():
  ok_( cu._MatchesSemanticTrigger( '.', 1, [cu._PrepareTrigger( '.' )] ) )
  ok_( not cu._MatchesSemanticTrigger( '.', 0, [cu._PrepareTrigger( '.' )] ) )
예제 #28
0
def MatchesSemanticTrigger_TriggerBetweenWords_test():
    ok_(cu._MatchesSemanticTrigger('foo . bar', 5, [cu._PrepareTrigger('.')]))
예제 #29
0
def MatchesSemanticTrigger_JustTrigger_test():
  ok_( cu._MatchesSemanticTrigger( '.', 1, ['.'] ) )
  ok_( not cu._MatchesSemanticTrigger( '.', 0, ['.'] ) )
예제 #30
0
def MatchesSemanticTrigger_RegexTrigger_test():
  triggers = [ cu._PrepareTrigger( r're!\w+\.' ) ]

  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 4, 8, triggers ) )

  ok_( not cu._MatchesSemanticTrigger( 'foo . bar', 5, 8, triggers ) )
예제 #31
0
def MatchesSemanticTrigger_JustTrigger_test():
  triggers = [ cu._PrepareTrigger( '.' ) ]

  ok_( not cu._MatchesSemanticTrigger( '.', 2, 2, triggers ) )
  ok_( cu._MatchesSemanticTrigger( '.', 1, 1, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( '.', 0, 0, triggers ) )
예제 #32
0
def MatchesSemanticTrigger_Basic_test():
    triggers = [cu._PrepareTrigger('.')]

    ok_(not cu._MatchesSemanticTrigger('foo.bar', 7, 7, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 6, 7, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 5, 7, triggers))
    ok_(cu._MatchesSemanticTrigger('foo.bar', 4, 7, triggers))
    ok_(cu._MatchesSemanticTrigger('foo.bar', 3, 7, triggers))
    ok_(cu._MatchesSemanticTrigger('foo.bar', 2, 7, triggers))
    ok_(cu._MatchesSemanticTrigger('foo.bar', 1, 7, triggers))
    ok_(cu._MatchesSemanticTrigger('foo.bar', 0, 7, triggers))

    ok_(not cu._MatchesSemanticTrigger('foo.bar', 3, 3, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 2, 3, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 1, 3, triggers))
    ok_(not cu._MatchesSemanticTrigger('foo.bar', 0, 3, triggers))
예제 #33
0
def MatchesSemanticTrigger_Basic_test():
  triggers = [ cu._PrepareTrigger( '.' ) ]

  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 7, 7, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 6, 7, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 5, 7, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 4, 7, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 3, 7, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 2, 7, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 1, 7, triggers ) )
  ok_( cu._MatchesSemanticTrigger( 'foo.bar', 0, 7, triggers ) )

  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 3, 3, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 2, 3, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 1, 3, triggers ) )
  ok_( not cu._MatchesSemanticTrigger( 'foo.bar', 0, 3, triggers ) )