From fbc90615673df80e76b8233195b3b49b351bfbdb Mon Sep 17 00:00:00 2001 From: Freddy Heppell Date: Tue, 2 Jul 2024 14:51:34 +0100 Subject: [PATCH] convert pickle fixtures to json tables --- tests/extractors/__init__.py | 0 tests/extractors/test_categories.py | 2 +- .../test_categories/categories_df_out.json | 74 ++++++++++++++++++ .../test_categories/categories_df_out.pickle | Bin 1355 -> 0 bytes tests/extractors/test_tags.py | 2 +- tests/extractors/test_tags/tags_df_out.json | 67 ++++++++++++++++ tests/extractors/test_tags/tags_df_out.pickle | Bin 1136 -> 0 bytes tests/extractors/test_users.py | 2 +- tests/extractors/test_users/users_df_out.json | 49 ++++++++++++ .../extractors/test_users/users_df_out.pickle | Bin 935 -> 0 bytes 10 files changed, 193 insertions(+), 3 deletions(-) create mode 100644 tests/extractors/__init__.py create mode 100644 tests/extractors/test_categories/categories_df_out.json delete mode 100644 tests/extractors/test_categories/categories_df_out.pickle create mode 100644 tests/extractors/test_tags/tags_df_out.json delete mode 100644 tests/extractors/test_tags/tags_df_out.pickle create mode 100644 tests/extractors/test_users/users_df_out.json delete mode 100644 tests/extractors/test_users/users_df_out.pickle diff --git a/tests/extractors/__init__.py b/tests/extractors/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/extractors/test_categories.py b/tests/extractors/test_categories.py index 4ae0a12..13f7f26 100644 --- a/tests/extractors/test_categories.py +++ b/tests/extractors/test_categories.py @@ -19,7 +19,7 @@ def categories_df(categories_df_and_registry): def test_equals_expected(datadir, categories_df): - expected_df = pd.read_pickle(datadir / "categories_df_out.pickle") + expected_df = pd.read_json(datadir / "categories_df_out.json", orient="table") assert categories_df.equals(expected_df) diff --git a/tests/extractors/test_categories/categories_df_out.json b/tests/extractors/test_categories/categories_df_out.json new file mode 100644 index 0000000..91342c2 --- /dev/null +++ b/tests/extractors/test_categories/categories_df_out.json @@ -0,0 +1,74 @@ +{ + "schema":{ + "fields":[ + { + "name":"id", + "type":"integer" + }, + { + "name":"count", + "type":"integer" + }, + { + "name":"description", + "type":"string" + }, + { + "name":"link", + "type":"string" + }, + { + "name":"name", + "type":"string" + }, + { + "name":"slug", + "type":"string" + }, + { + "name":"parent", + "type":"number" + }, + { + "name":"link_locale", + "type":"string" + } + ], + "primaryKey":[ + "id" + ], + "pandas_version":"1.4.0" + }, + "data":[ + { + "id":1, + "count":3, + "description":"About Test Category One", + "link":"https:\/\/example.org\/test-category-one\/", + "name":"Test Category One", + "slug":"test-category-one", + "parent":null, + "link_locale":null + }, + { + "id":2, + "count":3, + "description":"About Test Category Two", + "link":"https:\/\/example.org\/fr\/test-category-two\/", + "name":"Test Category Two", + "slug":"test-category-two", + "parent":null, + "link_locale":"fr" + }, + { + "id":3, + "count":3, + "description":"About Test Category Three", + "link":"https:\/\/example.org\/fr\/test-category-three\/", + "name":"Test Category Three", + "slug":"test-category-three", + "parent":2.0, + "link_locale":"fr" + } + ] +} \ No newline at end of file diff --git a/tests/extractors/test_categories/categories_df_out.pickle b/tests/extractors/test_categories/categories_df_out.pickle deleted file mode 100644 index ad877219ae7cd497bd2d2e7991a8b0997e06eac5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1355 zcma)6TWb?R6wYm1ZAEQMZwRF?YJxO*5fKqutq6571*!NTWtrW~W|q#*E;F;F0gL+3 z8_Zje{jI*~na!poF$MQw&s@H9=3KsWemK8&oKpUog_MX6QOzKcv>8egQ!sbm5l!Cb z>nmvdgcGQnniqE^n2k|*Bs7(RaMg^7AYCdIn0s$|5*&RT?BNQ`N}=KL$XCr96)+FH zOr%k8#Hr_79SdF*S)BF<&ft>DC;&6>g))i#EDWhcQ2lys;Crchiv;83c2IV7Kc&`k zC3*>$7w7N^>TcDPUqidy{_qFC{O6W5_-@&)o`EUvf<~CR<7W}qk-(rF#iPKQaZ3m) zTPtqG{@J`)9&tI&P=QEE`j`k$(jXB^%Pi2S${w0o%yfQf4V}Vn*@uBcW!JG!vqe+c zA9M5Dgqz#w=H(%lWA%-nWP0;}D!sW&H0>s`zqv24cvEi# z<1AVnKSQU$EKQu{;kQjCl)$zrrkCBXU)Kv_l?z#!AX=^1&lD2avg@1zTerj+GQ%1g zGIfCa{e4`PcJh*kBPC}mxAAgdoNXXgW=1J^4wesV<9*qo$5b_aqOi1co}fK%PvDuQ z;b-Fv*Lh!eu-Ab-W=}08Sz}1ZS=_X8syRWD35{*op(>D3s-r}Jsqsi0p%D4Rs41Rx z!OWyY(j04VJ?v`2DcGzQz;>ENhnKpH+xwwn_ZGD*MbFo z@N6M(9sPH8lDpnrk9J{`O!CdlmrTC=X#Jthn)}Sdl8A&TKQ1KoQ%Q0P=H5r5$tO3y zgq@#o2HU0?<~<2!V-}tXO{E}Q`8g4!N2LO@{DBv7|6pXpC78!!kC11P@+U4}?uV5q zv$)S`7+D_+UKLedo{q@ikjg9uvlOPX$fGJvsYKBB-}MpqTH}@;Ov}Z=KGCNowUO)D z8@M?C4PRk9Xc+Gubi3Uz|L}87P}2|vUeFkV@%BL@%-oHtjO$F`rdo<;u?-W{5aih? zLEW}&$*j##&MR~vQj$|Vh)~kF5K7A`*67L}m^*mVZqWw%1^ZqEBSK!#vZ>jssUKdW z`F)P&9@4xx#&WE_kBUlf9#Mr2>1`egtlRwL(VzhHXbySABt`5N)4Eh|+iiM6@{&`( zkiE7h_+!Xj9PAc?w!u8V375(#Ob-f#y}S)J8&TWT2wuKUdulquE0fhR)#X`A=shtp zHJFvD>2}sN^;81eqj*$o1Ix8ATd*P6(_6oOixYZ6l^+p>=du_IItV)g=WNkFo7UCX zsUSgR0NY|OYysKMRrwasXuHC+;-V57FKt3qEVEK)g#gp!ndoCDoW7chS3QK-$q=tT z;S?<0@p`u!+N;$u&u*eQk;P(1=-01i*s%k)G8Kn67Ds(fB*4~!2GV_MFFE^$!brd+ zq&6$+92J94fZgcTa}efK6SwnY)B@2Og?kwr diff --git a/tests/extractors/test_users.py b/tests/extractors/test_users.py index 6fffde8..9d219ba 100644 --- a/tests/extractors/test_users.py +++ b/tests/extractors/test_users.py @@ -9,5 +9,5 @@ def users_df(datadir): def test_user_load(datadir, users_df): - expected_df = pd.read_pickle(datadir / "users_df_out.pickle") + expected_df = pd.read_json(datadir / "users_df_out.json", orient="table") assert users_df.equals(expected_df) diff --git a/tests/extractors/test_users/users_df_out.json b/tests/extractors/test_users/users_df_out.json new file mode 100644 index 0000000..0dc4de3 --- /dev/null +++ b/tests/extractors/test_users/users_df_out.json @@ -0,0 +1,49 @@ +{ + "schema":{ + "fields":[ + { + "name":"id", + "type":"integer" + }, + { + "name":"name", + "type":"string" + }, + { + "name":"url", + "type":"string" + }, + { + "name":"description", + "type":"string" + }, + { + "name":"link", + "type":"string" + }, + { + "name":"slug", + "type":"string" + }, + { + "name":"avatar", + "type":"string" + } + ], + "primaryKey":[ + "id" + ], + "pandas_version":"1.4.0" + }, + "data":[ + { + "id":1, + "name":"Author1", + "url":"https:\/\/author1.gate.ac.uk", + "description":"An author", + "link":"https:\/\/example.org\/author\/author1\/", + "slug":"author1", + "avatar":"https:\/\/secure.gravatar.com\/avatar\/f72c502e0d657f363b5f2dc79dd8ceea?s=500&d=mm&r=g" + } + ] +} \ No newline at end of file diff --git a/tests/extractors/test_users/users_df_out.pickle b/tests/extractors/test_users/users_df_out.pickle deleted file mode 100644 index ae37bb0481c2ea64697f2b0a89781e9b0415562e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 935 zcmZuw-%Axi7`?0as%0b^l_W$Eh`sE+YF8~1Q6sRW8~85E?Ck6h?(FO`KT;u~9yEn{ z^Q))+*ZOAnUeRbCX1|#|XE@)PGv7Kte^0jRVdpC%VxoLnO6Dh$6b$UW_e7Hqb$t!5 zzQY-;*mhW?672Ka@LXsn1>wpsh#)DG3haYDUee*GW)0V1pNtqG&m-mEP{7WGMpQW+ zau!C8dntWPWENE4s8;OesZKWV+MFc=Iz{=rdC!H$OL>Ii$C-ZeTaXL{QcgBfVh_%mqr! zR_)UN^x?HLnNyT_AoRxTTe7mgUAUE=8{ll1$g+q`k}!$Qto)j3lHc-1U&t2iM1Ch3 z@BT?f3!M$TbFkh%Xs2!u88OsKnUjmp14D+9aMp}pQCKidYOjv)GKkjrKF+Y`FySPv a%cq3%@>qqjsqm^WS|KM9;|ea7iTuB|T5L1`