def test_500k(): is_south = False letter = 'N' zone = 37 last_letter = u'А' nomk_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_500k( 37.61556, 55.75222) scale, min_x2, max_x2, min_y2, max_y2 = text.text_to_500k( letter, zone, last_letter, is_south) assert abs(min_x1 - min_x2) < delta assert abs(max_x1 - max_x2) < delta assert abs(min_y1 - min_y2) < delta assert abs(max_y1 - max_y2) < delta assert scale == '500k' assert nomk_str == u'N-37-А' is_south = True nomk_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_500k( 37.61556, -55.75222) last_letter = u'В' scale, min_x2, max_x2, min_y2, max_y2 = text.text_to_500k( letter, zone, last_letter, is_south) assert min_x1 - min_x2 < delta assert max_x1 - max_x2 < delta assert min_y1 - min_y2 < delta assert max_y1 - max_y2 < delta assert scale == '500k' assert nomk_str == u'N-37-В' + util.south_suffix()
def test_1m(): is_south = False letter = 'N' zone = 37 nomk_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_1m( 37.61556, 55.75222) scale, min_x2, max_x2, min_y2, max_y2 = text.text_to_1m( letter, zone, is_south) assert abs(min_x1 - min_x2) < delta assert abs(max_x1 - max_x2) < delta assert abs(min_y1 - min_y2) < delta assert abs(max_y1 - max_y2) < delta assert scale == '1m' assert nomk_str == 'N-37' is_south = True nomk_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_1m( 37.61556, -55.75222) scale, min_x2, max_x2, min_y2, max_y2 = text.text_to_1m( letter, zone, is_south) assert abs(min_x1 - min_x2) < delta assert abs(max_x1 - max_x2) < delta assert abs(min_y1 - min_y2) < delta assert abs(max_y1 - max_y2) < delta assert scale == '1m' assert nomk_str == u'N-37' + util.south_suffix()
def test_200k_parse(): nomk_str = 'T-48-XXVIII,XXIX,XXX' scale, parts, is_south = parser.parse(nomk_str, '200k') assert scale == '200k' assert len(parts) == 3 assert parts[0] == 'T' assert parts[1] == 48 assert parts[2] == 'XXX' assert is_south == False nomk_str = 'A-15-XIX' + util.south_suffix() scale, parts, is_south = parser.parse(nomk_str) assert scale == '200k' assert len(parts) == 3 assert parts[0] == 'A' assert parts[1] == 15 assert parts[2] == 'XIX' assert is_south == True
def test_100k_parse(): nomk_str = 'U-48-141,142,143,144' scale, parts, is_south = parser.parse(nomk_str, '100k') assert scale == '100k' assert len(parts) == 3 assert parts[0] == 'U' assert parts[1] == 48 assert parts[2] == 144 assert is_south == False nomk_str = 'A-15-009' + util.south_suffix() scale, parts, is_south = parser.parse(nomk_str) assert scale == '100k' assert len(parts) == 3 assert parts[0] == 'A' assert parts[1] == 15 assert parts[2] == 9 assert is_south == True
def test_50k_parse(): nomk_str = 'T-48-033-А,Б,034-А,Б' #U-49-135-В,Г,136-В,Г || T-48-035-А,Б,036-А,Б scale, parts, is_south = parser.parse(nomk_str, '50k') assert scale == '50k' assert len(parts) == 4 assert parts[0] == 'T' assert parts[1] == 48 assert parts[2] == 34 assert parts[3] == 'Б' assert is_south == False nomk_str = 'U-49-135-В,Г,136-В,Г' + util.south_suffix() scale, parts, is_south = parser.parse(nomk_str, '50k') assert scale == '50k' assert len(parts) == 4 assert parts[0] == 'U' assert parts[1] == 49 assert parts[2] == 136 assert parts[3] == 'Г' assert is_south == True
def test_200k(): is_south = False letter = 'N' zone = 37 last_letter = u'II' nomk_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_200k( 37.61556, 55.75222) scale, min_x2, max_x2, min_y2, max_y2 = text.text_to_200k( letter, zone, last_letter, is_south) assert abs(min_x1 - min_x2) < delta assert abs(max_x1 - max_x2) < delta assert abs(min_y1 - min_y2) < delta assert abs(max_y1 - max_y2) < delta assert scale == '200k' assert nomk_str == u'N-37-II' is_south = True nomk_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_200k( 37.61556, -55.75222) last_letter = u'XXXII' scale, min_x2, max_x2, min_y2, max_y2 = text.text_to_200k( letter, zone, last_letter, is_south) assert abs(min_x1 - min_x2) < delta assert abs(max_x1 - max_x2) < delta assert abs(min_y1 - min_y2) < delta assert abs(max_y1 - max_y2) < delta assert scale == '200k' assert nomk_str == u'N-37-XXXII' + util.south_suffix() nomk1_str, min_x1, max_x1, min_y1, max_y1 = coord.coords_to_200k( 29.4643518467, 60.4127030704) nomk2_str, min_x2, max_x2, min_y2, max_y2 = coord.coords_to_200k( 29.4643518467, 61.0793697371) assert nomk1_str != nomk2_str and min_y1 != min_y2 and max_y1 != max_y2
def test_25k_parse(): nomk_str = 'T-48-047-А-а,б,Б-а,б' # U-49-137-В-а,б,Г-а,б || T-48-046-А-а,б,Б-а,б scale, parts, is_south = parser.parse(nomk_str, '25k') assert scale == '25k' assert len(parts) == 5 assert parts[0] == 'T' assert parts[1] == 48 assert parts[2] == 47 assert parts[3] == 'Б' assert parts[4] == 'б' assert is_south == False nomk_str = 'U-49-137-В-а,б,Г-а,б' + util.south_suffix() scale, parts, is_south = parser.parse(nomk_str, '25k') assert scale == '25k' assert len(parts) == 5 assert parts[0] == 'U' assert parts[1] == 49 assert parts[2] == 137 assert parts[3] == 'Г' assert parts[4] == 'б' assert is_south == True
def test_500k_parse(): nomk_str = 'O-48-Г' scale, parts, is_south = parser.parse(nomk_str, '500k') assert scale == '500k' assert len(parts) == 3 assert parts[0] == 'O' assert parts[1] == 48 assert parts[2] == 'Г' assert is_south == False nomk_str = 'N-48-Б' + util.south_suffix() scale, parts, is_south = parser.parse(nomk_str, '500k') assert scale == '500k' assert len(parts) == 3 assert parts[0] == 'N' assert parts[1] == 48 assert parts[2] == 'Б' assert is_south == True nomk_str = 'P-49-А,Б' scale, parts, is_south = parser.parse(nomk_str, '500k') assert scale == '500k' assert len(parts) == 3 assert parts[0] == 'P' assert parts[1] == 49 assert parts[2] == 'Б' assert is_south == False nomk_str = 'T-47-В,Г,48-В,Г' scale, parts, is_south = parser.parse(nomk_str, '500k') assert scale == '500k' assert len(parts) == 3 assert parts[0] == 'T' assert parts[1] == 48 assert parts[2] == 'Г' assert is_south == False
def test_1m_parse(): nomk_str = 'N-37' scale, parts, is_south = parser.parse(nomk_str, '1m') assert scale == '1m' assert len(parts) == 2 assert parts[0] == 'N' assert parts[1] == 37 assert is_south == False nomk_str = 'U-37,38,39,40' scale, parts, is_south = parser.parse(nomk_str) assert scale == '1m' assert len(parts) == 2 assert parts[0] == 'U' assert parts[1] == 40 assert is_south == False nomk_str = 'A-15' + util.south_suffix() scale, parts, is_south = parser.parse(nomk_str) assert scale == '1m' assert len(parts) == 2 assert parts[0] == 'A' assert parts[1] == 15 assert is_south == True