summaryrefslogtreecommitdiff
path: root/dev-python/networkx/files/networkx-2.4-py38.patch
blob: 9ce3003d1042060f204cc75203a1e306b412336e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From 488e824439124f4dd52f8230c452a3df681b1bab Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Fri, 15 Nov 2019 13:48:33 +1100
Subject: [PATCH] Fix test_numpy_type to pass under Python 3.8

readwrite.tests.test_gexf.TestGEXF.test_numpy_type failed under Python
3.8 due to ordering of XML attributes, handle it as per f75dbe8. Also
change travis to no longer allow failures under 3.8.

Fixes #3720
---
 .travis.yml                           |  2 --
 networkx/readwrite/tests/test_gexf.py | 51 ++++++++++++++++++++++++++-
 2 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/networkx/readwrite/tests/test_gexf.py b/networkx/readwrite/tests/test_gexf.py
index afc40111ce..f16504c047 100644
--- a/networkx/readwrite/tests/test_gexf.py
+++ b/networkx/readwrite/tests/test_gexf.py
@@ -404,7 +404,8 @@ def test_numpy_type(self):
         nx.set_node_attributes(G, {n: n for n in numpy.arange(4)}, 'number')
         G[0][1]['edge-number'] = numpy.float64(1.1)
 
-        expected = """<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft"\
+        if sys.version_info < (3, 8):
+            expected = """<gexf version="1.2" xmlns="http://www.gexf.net/1.2draft"\
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation\
 ="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd">
   <meta lastmodifieddate="{}">
@@ -449,6 +450,54 @@ def test_numpy_type(self):
       <edge id="2" source="2" target="3" />
     </edges>
   </graph>
+</gexf>""".format(time.strftime('%Y-%m-%d'), nx.__version__)
+        else:
+            expected = """<gexf xmlns="http://www.gexf.net/1.2draft"\
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation\
+="http://www.gexf.net/1.2draft http://www.gexf.net/1.2draft/gexf.xsd"\
+ version="1.2">
+  <meta lastmodifieddate="{}">
+    <creator>NetworkX {}</creator>
+  </meta>
+  <graph defaultedgetype="undirected" mode="static" name="">
+    <attributes mode="static" class="edge">
+      <attribute id="1" title="edge-number" type="float" />
+    </attributes>
+    <attributes mode="static" class="node">
+      <attribute id="0" title="number" type="int" />
+    </attributes>
+    <nodes>
+      <node id="0" label="0">
+        <attvalues>
+          <attvalue for="0" value="0" />
+        </attvalues>
+      </node>
+      <node id="1" label="1">
+        <attvalues>
+          <attvalue for="0" value="1" />
+        </attvalues>
+      </node>
+      <node id="2" label="2">
+        <attvalues>
+          <attvalue for="0" value="2" />
+        </attvalues>
+      </node>
+      <node id="3" label="3">
+        <attvalues>
+          <attvalue for="0" value="3" />
+        </attvalues>
+      </node>
+    </nodes>
+    <edges>
+      <edge source="0" target="1" id="0">
+        <attvalues>
+          <attvalue for="1" value="1.1" />
+        </attvalues>
+      </edge>
+      <edge source="1" target="2" id="1" />
+      <edge source="2" target="3" id="2" />
+    </edges>
+  </graph>
 </gexf>""".format(time.strftime('%Y-%m-%d'), nx.__version__)
         obtained = '\n'.join(nx.generate_gexf(G))
         assert expected == obtained