Best Python code snippet using green
test_data_updater.py
Source:test_data_updater.py
1import pytest2from decimal import Decimal3from replisome.errors import ReplisomeError4from replisome.consumers.DataUpdater import DataUpdater5from replisome.receivers.JsonReceiver import JsonReceiver6def test_insert(src_db, tgt_db, called):7 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True,8 skip_missing_tables=True)9 c = called(du, 'process_message')10 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)11 src_db.thread_receive(jr, src_db.make_repl_conn())12 scur = src_db.conn.cursor()13 tcur = tgt_db.conn.cursor()14 scur.execute("drop table if exists testins")15 scur.execute(16 "create table testins (id serial primary key, data text, more text)")17 tcur.execute("drop table if exists testins")18 tcur.execute("""19 create table testins (20 id integer primary key,21 data text,22 ts timestamptz not null default now(),23 clock timestamptz not null default clock_timestamp())24 """)25 scur.execute("insert into testins (data) values ('hello')")26 c.get()27 tcur.execute("select * from testins")28 rs = tcur.fetchall()29 assert len(rs) == 130 r = rs[0]31 assert r[0] == 132 assert r[1] == 'hello'33 # Test records are inserted in the same transaction34 scur.execute("begin")35 scur.execute("insert into testins default values")36 scur.execute("insert into testins default values")37 scur.execute("commit")38 c.get()39 tcur.execute("select * from testins where id > 1 order by id")40 rs = tcur.fetchall()41 assert len(rs) == 242 assert rs[0][0] == 243 assert rs[1][0] == 344 assert rs[0][2] == rs[1][2]45 assert rs[0][3] < rs[1][3]46 # Missing tables are ignored47 scur.execute("drop table if exists notable")48 scur.execute(49 "create table notable (id serial primary key)")50 scur.execute("insert into notable default values")51 c.get()52 scur.execute("insert into testins default values")53 c.get()54 tcur.execute("select max(id) from testins")55 assert tcur.fetchone()[0] == 456def test_insert_missing_table(src_db, tgt_db, called):57 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True)58 c = called(du, 'process_message')59 rconn = src_db.make_repl_conn()60 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)61 src_db.thread_receive(jr, rconn)62 scur = src_db.conn.cursor()63 tcur = tgt_db.conn.cursor()64 scur.execute("drop table if exists testins")65 scur.execute(66 "create table testins (id serial primary key, data text)")67 tcur.execute("drop table if exists testins")68 scur.execute("insert into testins (data) values ('hello')")69 with pytest.raises(ReplisomeError):70 c.get()71 jr.stop()72 rconn.close()73 tcur.execute("create table testins (id serial primary key, data text)")74 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)75 src_db.thread_receive(jr, src_db.make_repl_conn())76 c.get()77 tcur.execute("select * from testins")78 assert tcur.fetchall() == [(1, 'hello')]79def test_insert_missing_col(src_db, tgt_db, called):80 du = DataUpdater(tgt_db.conn.dsn)81 c = called(du, 'process_message')82 rconn = src_db.make_repl_conn()83 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)84 src_db.thread_receive(jr, rconn)85 scur = src_db.conn.cursor()86 tcur = tgt_db.conn.cursor()87 scur.execute("drop table if exists testins")88 scur.execute(89 "create table testins (id serial primary key, data text, more text)")90 tcur.execute("drop table if exists testins")91 tcur.execute("""92 create table testins (93 id integer primary key,94 data text)95 """)96 scur.execute("insert into testins (data) values ('hello')")97 with pytest.raises(ReplisomeError):98 c.get()99 tcur.execute("select * from testins")100 assert tcur.fetchall() == []101 jr.stop()102 rconn.close()103 tcur.execute("alter table testins add more text")104 du = DataUpdater(tgt_db.conn.dsn)105 c = called(du, 'process_message')106 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)107 src_db.thread_receive(jr, src_db.make_repl_conn())108 c.get()109 tcur.execute("select * from testins")110 assert tcur.fetchall() == [(1, 'hello', None)]111def test_insert_conflict(src_db, tgt_db, called):112 du = DataUpdater(tgt_db.conn.dsn, upsert=True, skip_missing_columns=True)113 c = called(du, 'process_message')114 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)115 src_db.thread_receive(jr, src_db.make_repl_conn())116 scur = src_db.conn.cursor()117 tcur = tgt_db.conn.cursor()118 scur.execute("drop table if exists testins")119 scur.execute("""120 create table testins (121 id serial primary key, data text, foo text, more text)122 """)123 tcur.execute("drop table if exists testins")124 tcur.execute("""125 create table testins (126 id integer primary key, data text, foo text, n int)127 """)128 tcur.execute(129 "insert into testins (id, data, foo, n) values (1, 'foo', 'ouch', 42)")130 scur.execute(131 "insert into testins (data, foo, more) values ('baz', 'qux', 'quux')")132 if tgt_db.conn.server_version >= 90500:133 c.get()134 else:135 with pytest.raises(ReplisomeError):136 c.get()137 pytest.skip()138 tcur.execute("select * from testins")139 rs = tcur.fetchall()140 assert len(rs) == 1141 assert rs[0] == (1, 'baz', 'qux', 42)142def test_insert_conflict_do_nothing(src_db, tgt_db, called):143 du = DataUpdater(tgt_db.conn.dsn, upsert=True, skip_missing_columns=True)144 c = called(du, 'process_message')145 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)146 src_db.thread_receive(jr, src_db.make_repl_conn())147 scur = src_db.conn.cursor()148 tcur = tgt_db.conn.cursor()149 scur.execute("drop table if exists testinsmini")150 scur.execute("create table testinsmini (id serial primary key, data text)")151 tcur.execute("drop table if exists testinsmini")152 tcur.execute("create table testinsmini (id serial primary key, other text)")153 tcur.execute(154 "insert into testinsmini (id, other) values (1, 'foo')")155 scur.execute(156 "insert into testinsmini (data) values ('bar')")157 if tgt_db.conn.server_version >= 90500:158 c.get()159 else:160 with pytest.raises(ReplisomeError):161 c.get()162 pytest.skip()163 tcur.execute("select * from testinsmini")164 rs = tcur.fetchall()165 assert len(rs) == 1166 assert rs[0] == (1, 'foo')167def test_update(src_db, tgt_db, called):168 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True,169 skip_missing_tables=True)170 c = called(du, 'process_message')171 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)172 src_db.thread_receive(jr, src_db.make_repl_conn())173 scur = src_db.conn.cursor()174 tcur = tgt_db.conn.cursor()175 scur.execute("drop table if exists testup")176 scur.execute(177 "create table testup (id serial primary key, data text, more text)")178 tcur.execute("drop table if exists testup")179 tcur.execute("""180 create table testup (181 id integer primary key,182 data text,183 ts timestamptz not null default now(),184 clock timestamptz not null default clock_timestamp())185 """)186 scur.execute("insert into testup (data) values ('hello')")187 scur.execute("insert into testup (data) values ('world')")188 scur.execute("update testup set data = 'mama' where id = 2")189 for i in range(3):190 c.get()191 tcur.execute("select id, data from testup order by id")192 rs = tcur.fetchall()193 assert rs == [(1, 'hello'), (2, 'mama')]194 # The key can change too195 scur.execute("update testup set id = 22 where id = 2")196 c.get()197 tcur.execute("select id, data from testup order by id")198 rs = tcur.fetchall()199 assert rs == [(1, 'hello'), (22, 'mama')]200 # Missing tables are ignored201 scur.execute("drop table if exists notable")202 scur.execute(203 "create table notable (id serial primary key)")204 scur.execute("insert into notable default values")205 c.get()206 scur.execute("update notable set id = 2 where id = 1")207 c.get()208 scur.execute("insert into testup default values")209 c.get()210 tcur.execute("select id from testup where id = 3")211 assert tcur.fetchone()[0] == 3212def test_update_missing_table(src_db, tgt_db, called):213 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True)214 c = called(du, 'process_message')215 rconn = src_db.make_repl_conn()216 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)217 src_db.thread_receive(jr, rconn)218 scur = src_db.conn.cursor()219 tcur = tgt_db.conn.cursor()220 scur.execute("drop table if exists testins")221 scur.execute("drop table if exists testins2")222 scur.execute(223 "create table testins (id serial primary key, data text)")224 tcur.execute("drop table if exists testins")225 tcur.execute("drop table if exists testins2")226 tcur.execute("create table testins (id serial primary key, data text)")227 scur.execute("insert into testins (data) values ('hello')")228 c.get()229 scur.execute("alter table testins rename to testins2")230 scur.execute("update testins2 set data = 'world' where id = 1")231 with pytest.raises(ReplisomeError):232 c.get()233 jr.stop()234 rconn.close()235 tcur.execute("alter table testins rename to testins2")236 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)237 src_db.thread_receive(jr, src_db.make_repl_conn())238 c.get()239 tcur.execute("select * from testins2")240 assert tcur.fetchall() == [(1, 'world')]241def test_update_missing_col(src_db, tgt_db, called):242 du = DataUpdater(tgt_db.conn.dsn)243 c = called(du, 'process_message')244 rconn = src_db.make_repl_conn()245 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)246 src_db.thread_receive(jr, rconn)247 scur = src_db.conn.cursor()248 tcur = tgt_db.conn.cursor()249 scur.execute("drop table if exists testup")250 scur.execute(251 "create table testup (id serial primary key, data text)")252 tcur.execute("drop table if exists testup")253 tcur.execute("""254 create table testup (255 id integer primary key,256 data text)257 """)258 scur.execute("insert into testup (data) values ('hello')")259 scur.execute("insert into testup (data) values ('world')")260 scur.execute("alter table testup add more text")261 scur.execute("update testup set more = 'mama' where id = 2")262 for i in range(2):263 c.get()264 with pytest.raises(ReplisomeError):265 c.get()266 tcur.execute("select id, data from testup order by id")267 rs = tcur.fetchall()268 assert rs == [(1, 'hello'), (2, 'world')]269 jr.stop()270 rconn.close()271 tcur.execute("alter table testup add more text")272 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)273 src_db.thread_receive(jr, src_db.make_repl_conn())274 c.get()275 tcur.execute("select id, data, more from testup order by id")276 rs = tcur.fetchall()277 assert rs == [(1, 'hello', None), (2, 'world', 'mama')]278def test_delete(src_db, tgt_db, called):279 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True,280 skip_missing_tables=True)281 c = called(du, 'process_message')282 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)283 src_db.thread_receive(jr, src_db.make_repl_conn())284 scur = src_db.conn.cursor()285 tcur = tgt_db.conn.cursor()286 scur.execute("drop table if exists testdel")287 scur.execute(288 "create table testdel (id serial primary key, data text)")289 tcur.execute("drop table if exists testdel")290 tcur.execute(291 "create table testdel (id serial primary key, data text)")292 scur.execute("insert into testdel (data) values ('hello')")293 scur.execute("insert into testdel (data) values ('world')")294 scur.execute("delete from testdel where id = 2")295 scur.execute("insert into testdel (data) values ('mama')")296 for i in range(4):297 c.get()298 tcur.execute("select id, data from testdel order by id")299 rs = tcur.fetchall()300 assert rs == [(1, 'hello'), (3, 'mama')]301 # Missing tables are ignored302 scur.execute("drop table if exists notable")303 scur.execute(304 "create table notable (id serial primary key)")305 scur.execute("insert into notable default values")306 c.get()307 scur.execute("delete from notable where id = 1")308 c.get()309 scur.execute("insert into testdel default values")310 c.get()311 tcur.execute("select id from testdel where id = 4")312 assert tcur.fetchone()[0] == 4313def test_delete_missing_table(src_db, tgt_db, called):314 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True)315 c = called(du, 'process_message')316 rconn = src_db.make_repl_conn()317 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)318 src_db.thread_receive(jr, rconn)319 scur = src_db.conn.cursor()320 tcur = tgt_db.conn.cursor()321 scur.execute("drop table if exists testins")322 scur.execute("drop table if exists testins2")323 scur.execute(324 "create table testins (id serial primary key, data text)")325 tcur.execute("drop table if exists testins")326 tcur.execute("drop table if exists testins2")327 tcur.execute("create table testins (id serial primary key, data text)")328 scur.execute("insert into testins (data) values ('hello'), ('world')")329 c.get()330 scur.execute("alter table testins rename to testins2")331 scur.execute("delete from testins2 where id = 1")332 with pytest.raises(ReplisomeError):333 c.get()334 jr.stop()335 rconn.close()336 tcur.execute("alter table testins rename to testins2")337 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)338 src_db.thread_receive(jr, src_db.make_repl_conn())339 c.get()340 tcur.execute("select * from testins2")341 assert tcur.fetchall() == [(2, 'world')]342def test_toast(src_db, tgt_db, called):343 du = DataUpdater(tgt_db.conn.dsn, skip_missing_columns=True)344 c = called(du, 'process_message')345 rconn = src_db.make_repl_conn()346 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)347 src_db.thread_receive(jr, rconn)348 scur = src_db.conn.cursor()349 tcur = tgt_db.conn.cursor()350 scur.execute("drop table if exists xpto")351 scur.execute("""352 create table xpto (353 id serial primary key,354 toast1 text,355 other float8,356 toast2 text)357 """)358 tcur.execute("drop table if exists xpto")359 tcur.execute("""360 create table xpto (361 id integer primary key,362 toast1 text,363 other float8,364 toast2 text)365 """)366 # uncompressed external toast data367 scur.execute("""368 insert into xpto (toast1, toast2)369 select string_agg(g.i::text, ''), string_agg((g.i*2)::text, '')370 from generate_series(1, 2000) g(i)371 """)372 c.get()373 tcur.execute("select * from xpto where id = 1")374 r1 = tcur.fetchone()375 assert r1376 assert len(r1[1]) > 1000377 assert len(r1[3]) > 1000378 # compressed external toast data379 scur.execute("""380 insert into xpto (toast2)381 select repeat(string_agg(to_char(g.i, 'fm0000'), ''), 50)382 from generate_series(1, 500) g(i)383 """)384 c.get()385 tcur.execute("select * from xpto where id = 2")386 r2 = tcur.fetchone()387 assert r2388 assert r2[1] is None389 assert len(r2[3]) > 1000390 # update of existing column391 scur.execute("""392 update xpto set toast1 = (select string_agg(g.i::text, '')393 from generate_series(1, 2000) g(i)) where id = 1394 """)395 c.get()396 tcur.execute("select * from xpto where id = 1")397 r11 = tcur.fetchone()398 assert len(r11[1]) > 1000399 assert r11[1] == r1[1]400 assert r11[3] == r1[3]401 scur.execute("update xpto set other = 123.456 where id = 1")402 c.get()403 tcur.execute("select * from xpto where id = 1")404 r12 = tcur.fetchone()405 assert len(r12[1]) > 1000406 assert len(r12[3]) > 1000407 assert r11[1] == r12[1]408 assert r12[3] == r12[3]409 scur.execute("delete from xpto where id = 1")410 c.get()411 tcur.execute("select * from xpto where id = 1")412 assert not tcur.fetchone()413def test_numeric(src_db, tgt_db, called):414 du = DataUpdater(tgt_db.conn.dsn)415 c = called(du, 'process_message')416 rconn = src_db.make_repl_conn()417 jr = JsonReceiver(slot=src_db.slot, message_cb=du.process_message)418 src_db.thread_receive(jr, rconn)419 scur = src_db.conn.cursor()420 tcur = tgt_db.conn.cursor()421 for _c in [scur, tcur]:422 _c.execute("drop table if exists num")423 _c.execute("""424 create table num (425 id integer primary key,426 num numeric)427 """)428 scur.execute("""429 insert into num values430 (1, 1.000000000000000000000000000000000000000000000000000000000000001)431 """)432 scur.execute("select num from num where id = 1")433 sn = scur.fetchone()[0]434 assert isinstance(sn, Decimal)435 assert len(str(sn)) > 20436 c.get()437 tcur.execute("select num from num where id = 1")438 tn = tcur.fetchone()[0]...
Day 09.py
Source:Day 09.py
...41 isNine = heightMap[rowCoord][colCoord] == 942 isAdjacent = heightMap[rowCoord][colCoord] == downCoord(heightMap, rowCoord, colCoord) - 143 return (not isNine) & isAdjacent4445def testUp(heightMap, rowCoord, colCoord, basinTest = False):46 if not basinTest:47 return heightMap[rowCoord][colCoord] < upCoord(heightMap, rowCoord, colCoord)48 else:49 isNine = heightMap[rowCoord][colCoord] == 950 isAdjacent = heightMap[rowCoord][colCoord] == upCoord(heightMap, rowCoord, colCoord) - 151 return (not isNine) & isAdjacent5253def isLowPoint(coords, heightMap, basinTest = False):54 rowCoord = coords[0]55 colCoord = coords[1]56 nrows = len(heightMap)57 ncols = len(heightMap[0])58 topLeft = (rowCoord == 0) & (colCoord == 0)59 topRight = (rowCoord == 0) & (colCoord == ncols - 1)60 bottomLeft = (rowCoord == nrows - 1) & (colCoord == 0)61 bottomRight = (rowCoord == nrows - 1) & (colCoord == ncols - 1)62 corner = any([topLeft, topRight, bottomLeft, bottomRight])63 topEdge = rowCoord == 064 bottomEdge = rowCoord == nrows - 165 leftEdge = colCoord == 066 rightEdge = colCoord == ncols - 167 if topLeft:68 if not basinTest:69 right = testRight(heightMap, rowCoord, colCoord)70 down = testDown(heightMap, rowCoord, colCoord)71 return right & down72 else:73 right = testRight(heightMap, rowCoord, colCoord, basinTest)74 down = testDown(heightMap, rowCoord, colCoord, basinTest)75 basinCoords = []76 if right:77 basinCoords += [[rowCoord, colCoord + 1]]78 if down:79 basinCoords += [[rowCoord + 1, colCoord]]80 return basinCoords81 elif topRight:82 if not basinTest:83 left = testLeft(heightMap, rowCoord, colCoord)84 down = testDown(heightMap, rowCoord, colCoord)85 return left & down86 else:87 left = testLeft(heightMap, rowCoord, colCoord, basinTest)88 down = testDown(heightMap, rowCoord, colCoord, basinTest)89 basinCoords = []90 if left:91 basinCoords += [[rowCoord, colCoord - 1]]92 if down:93 basinCoords += [[rowCoord + 1, colCoord]]94 return basinCoords95 elif bottomLeft:96 if not basinTest:97 right = testRight(heightMap, rowCoord, colCoord)98 up = testUp(heightMap, rowCoord, colCoord)99 return right & up100 else:101 right = testRight(heightMap, rowCoord, colCoord, basinTest)102 up = testUp(heightMap, rowCoord, colCoord, basinTest)103 basinCoords = []104 if right:105 basinCoords += [[rowCoord, colCoord + 1]]106 if up:107 basinCoords += [[rowCoord - 1, colCoord]]108 return basinCoords109 elif bottomRight:110 if not basinTest:111 left = testLeft(heightMap, rowCoord, colCoord)112 up = testUp(heightMap, rowCoord, colCoord)113 return left & up114 else:115 left = testLeft(heightMap, rowCoord, colCoord, basinTest)116 up = testUp(heightMap, rowCoord, colCoord, basinTest)117 basinCoords = []118 if left:119 basinCoords += [[rowCoord, colCoord - 1]]120 if up:121 basinCoords += [[rowCoord - 1, colCoord]]122 return basinCoords123 elif (not corner) & topEdge:124 if not basinTest:125 left = testLeft(heightMap, rowCoord, colCoord)126 right = testRight(heightMap, rowCoord, colCoord)127 down = testDown(heightMap, rowCoord, colCoord)128 return left & right & down129 else:130 left = testLeft(heightMap, rowCoord, colCoord, basinTest)131 right = testRight(heightMap, rowCoord, colCoord, basinTest)132 down = testDown(heightMap, rowCoord, colCoord, basinTest)133 basinCoords = []134 if left:135 basinCoords += [[rowCoord, colCoord - 1]]136 if right:137 basinCoords += [[rowCoord, colCoord + 1]]138 if down:139 basinCoords += [[rowCoord + 1, colCoord]]140 return basinCoords141 elif (not corner) & bottomEdge:142 if not basinTest:143 left = testLeft(heightMap, rowCoord, colCoord)144 right = testRight(heightMap, rowCoord, colCoord)145 up = testUp(heightMap, rowCoord, colCoord)146 return left & right & up147 else:148 left = testLeft(heightMap, rowCoord, colCoord, basinTest)149 right = testRight(heightMap, rowCoord, colCoord, basinTest)150 up = testUp(heightMap, rowCoord, colCoord, basinTest)151 basinCoords = []152 if left:153 basinCoords += [[rowCoord, colCoord - 1]]154 if right:155 basinCoords += [[rowCoord, colCoord + 1]]156 if up:157 basinCoords += [[rowCoord - 1, colCoord]]158 return basinCoords159 elif (not corner) & leftEdge:160 if not basinTest:161 right = testRight(heightMap, rowCoord, colCoord)162 up = testUp(heightMap, rowCoord, colCoord)163 down = testDown(heightMap, rowCoord, colCoord)164 return right & up & down165 else:166 right = testRight(heightMap, rowCoord, colCoord, basinTest)167 up = testUp(heightMap, rowCoord, colCoord, basinTest)168 down = testDown(heightMap, rowCoord, colCoord, basinTest)169 basinCoords = []170 if right:171 basinCoords += [[rowCoord, colCoord + 1]]172 if up:173 basinCoords += [[rowCoord - 1, colCoord]]174 if down:175 basinCoords += [[rowCoord + 1, colCoord]]176 return basinCoords177 elif (not corner) & rightEdge:178 if not basinTest:179 left = testLeft(heightMap, rowCoord, colCoord)180 up = testUp(heightMap, rowCoord, colCoord)181 down = testDown(heightMap, rowCoord, colCoord)182 return left & up & down183 else:184 left = testLeft(heightMap, rowCoord, colCoord, basinTest)185 up = testUp(heightMap, rowCoord, colCoord, basinTest)186 down = testDown(heightMap, rowCoord, colCoord, basinTest)187 basinCoords = []188 if left:189 basinCoords += [[rowCoord, colCoord - 1]]190 if up:191 basinCoords += [[rowCoord - 1, colCoord]]192 if down:193 basinCoords += [[rowCoord + 1, colCoord]]194 return basinCoords195 else:196 if not basinTest:197 right = testRight(heightMap, rowCoord, colCoord)198 left = testLeft(heightMap, rowCoord, colCoord)199 up = testUp(heightMap, rowCoord, colCoord)200 down = testDown(heightMap, rowCoord, colCoord)201 return right & left & up & down202 else:203 right = testRight(heightMap, rowCoord, colCoord, basinTest)204 left = testLeft(heightMap, rowCoord, colCoord, basinTest)205 up = testUp(heightMap, rowCoord, colCoord, basinTest)206 down = testDown(heightMap, rowCoord, colCoord, basinTest)207 basinCoords = []208 if left:209 basinCoords += [[rowCoord, colCoord - 1]]210 if right:211 basinCoords += [[rowCoord, colCoord + 1]]212 if up:213 basinCoords += [[rowCoord - 1, colCoord]]214 if down:215 basinCoords += [[rowCoord + 1, colCoord]]216 return basinCoords217218def findLowCoords(heightMap):219 nrows = len(heightMap)
...
urls.py
Source:urls.py
1from django.conf.urls import url, include2from django.contrib import admin3from .views import main, testup, docfin4urlpatterns =[5url(r'^$',main),6url(r'^testup',testup),7url(r'^uploadtest',docfin),...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!