<s> "<STR_LIT>" <EOL> __revision__ = "<STR_LIT>" <EOL> import unittest <EOL> import os . path <EOL> test_path = os . path . split ( __file__ ) [ <NUM_LIT:0> ] <EOL> import sys <EOL> sys . path . append ( "<STR_LIT:.>" ) <EOL> from pywinauto import findbestmatch <EOL> from pywinauto import win32structures <EOL> class TestFindBestMatch ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . strings = open ( os . path . join ( test_path , "<STR_LIT>" ) , "<STR_LIT:rb>" ) . readlines ( ) <EOL> self . strings = ( line . decode ( '<STR_LIT:utf-8>' ) [ : - <NUM_LIT:1> ] for line in self . strings ) <EOL> def testclean_text_1 ( self ) : <EOL> s = "<STR_LIT>" <EOL> result = findbestmatch . _clean_non_chars ( s ) <EOL> self . assertEqual ( s , result ) <EOL> def testclean_text_2 ( self ) : <EOL> s = "<STR_LIT>" <EOL> result = findbestmatch . _clean_non_chars ( s ) <EOL> self . assertEqual ( '<STR_LIT>' , result ) <EOL> def testclean_text_3 ( self ) : <EOL> s = "<STR_LIT>" <EOL> result = findbestmatch . _clean_non_chars ( s ) <EOL> self . assertEqual ( '<STR_LIT>' , result ) <EOL> class DummyCtrl ( ) : <EOL> def __init__ ( self , l , t , r , b ) : <EOL> self . rect = win32structures . RECT ( l , t , r , b ) <EOL> def Rectangle ( self ) : <EOL> return self . rect <EOL> class TestIsAboveOrToLeft ( unittest . TestCase ) : <EOL> def testSameRect ( self ) : <EOL> "<STR_LIT>" <EOL> other = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> this = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , False ) <EOL> def testToLeft ( self ) : <EOL> other = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> this = DummyCtrl ( <NUM_LIT:100> , <NUM_LIT:20> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , True ) <EOL> def testAbove ( self ) : <EOL> other = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:200> , <NUM_LIT:30> ) <EOL> this = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , True ) <EOL> def testLeftAndTop ( self ) : <EOL> other = DummyCtrl ( <NUM_LIT:5> , <NUM_LIT:10> , <NUM_LIT:200> , <NUM_LIT:20> ) <EOL> this = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , True ) <EOL> def testBelow ( self ) : <EOL> other = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT> , <NUM_LIT:200> , <NUM_LIT> ) <EOL> this = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:20> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , False ) <EOL> def testToRight ( self ) : <EOL> other = DummyCtrl ( <NUM_LIT> , <NUM_LIT:20> , <NUM_LIT> , <NUM_LIT> ) <EOL> this = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:20> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , False ) <EOL> def testTopLeftInSideControl ( self ) : <EOL> other = DummyCtrl ( <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> ) <EOL> this = DummyCtrl ( <NUM_LIT:10> , <NUM_LIT:20> , <NUM_LIT:20> , <NUM_LIT> ) <EOL> result = findbestmatch . IsAboveOrToLeft ( this , other ) <EOL> self . assertEqual ( result , False ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
