1def test_in(s): 2 """ 3 >>> test_in('ABC') 4 1 5 >>> test_in('abc') 6 2 7 >>> test_in('X') 8 3 9 >>> test_in('XYZ') 10 4 11 >>> test_in('ABCXYZ') 12 5 13 >>> test_in('') 14 5 15 """ 16 if s in (u'ABC', u'BCD', u'ABC'[:3], u'ABC'[::-1], u'ABC'[-1]): 17 return 1 18 elif s.upper() in (u'ABC', u'BCD'): 19 return 2 20 elif len(s) in (1,2): 21 return 3 22 elif len(s) in (3,4): 23 return 4 24 else: 25 return 5 26 27def test_not_in(s): 28 """ 29 >>> test_not_in('abc') 30 1 31 >>> test_not_in('CDE') 32 2 33 >>> test_not_in('CDEF') 34 3 35 >>> test_not_in('BCD') 36 4 37 """ 38 if s not in (u'ABC', u'BCD', u'CDE', u'CDEF'): 39 return 1 40 elif s.upper() not in (u'ABC', u'BCD', u'CDEF'): 41 return 2 42 elif len(s) not in [3]: 43 return 3 44 elif len(s) not in [1,2]: 45 return 4 46 else: 47 return 5 48