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_5k_parse(): nomk_str = 'O-41-109-(064)' scale, parts, is_south = parser.parse(nomk_str, '5k') assert scale == '5k' assert len(parts) == 4 assert parts[0] == 'O' assert parts[1] == 41 assert parts[2] == 109 assert parts[3] == 64 assert is_south == False
def test_2k_parse(): nomk_str = 'M-38-125-(063)-а' scale, parts, is_south = parser.parse(nomk_str, '2k') assert scale == '2k' assert len(parts) == 5 assert parts[0] == 'M' assert parts[1] == 38 assert parts[2] == 125 assert parts[3] == 63 assert parts[4] == 'а' assert is_south == False
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_10k_parse(): nomk_str = 'T-47-004-А-а-1,2,б-1,2' # || U-47-136-В-в-3,4,г-3,4 || U-47-136-В-в-1,2,г-1,2 scale, parts, is_south = parser.parse(nomk_str, '10k') assert scale == '10k' assert len(parts) == 6 assert parts[0] == 'T' assert parts[1] == 47 assert parts[2] == 4 assert parts[3] == 'А' assert parts[4] == 'б' assert parts[5] == 2 assert is_south == False
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
print('1 : 200 000\t{}\t\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) nomk, min_x, max_x, min_y, max_y = coord.coords_to_100k(X, Y) print('1 : 100 000\t{}\t\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) nomk, min_x, max_x, min_y, max_y = coord.coords_to_50k(X, Y) print('1 : 50 000\t{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) nomk, min_x, max_x, min_y, max_y = coord.coords_to_25k(X, Y) print('1 : 25 000\t{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) nomk, min_x, max_x, min_y, max_y = coord.coords_to_10k(X, Y) print('1 : 10 000\t{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) nomk, min_x, max_x, min_y, max_y = coord.coords_to_5k(X, Y) print('1 : 5 000\t{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) nomk, min_x, max_x, min_y, max_y = coord.coords_to_2k(X, Y) print('1 : 2 000\t{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(nomk, min_x, min_y, max_x, max_y)) if args.nomk is not None: scale, parts, is_south = parser.parse(args.nomk, args.scale) if scale == '1m': scale, min_x, max_x, min_y, max_y = text.text_to_1m(parts[0], parts[1], is_south) print('{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(scale, min_x, min_y, max_x, max_y)) exit(0) elif scale == '500k': scale, min_x, max_x, min_y, max_y = text.text_to_500k(parts[0], parts[1], parts[2], is_south) print('{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(scale, min_x, min_y, max_x, max_y)) exit(0) elif scale == '200k': scale, min_x, max_x, min_y, max_y = text.text_to_200k(parts[0], parts[1], parts[2], is_south) print('{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(scale, min_x, min_y, max_x, max_y)) exit(0) elif scale == '100k': scale, min_x, max_x, min_y, max_y = text.text_to_100k(parts[0], parts[1], parts[2], is_south) print('{}\t[{:.6f} {:.6f}, {:.6f} {:.6f}]'.format(scale, min_x, min_y, max_x, max_y))