diff --git a/networkx/classes/reportviews.py b/networkx/classes/reportviews.py
index ac5255f2f..6fe61f28f 100644
--- a/networkx/classes/reportviews.py
+++ b/networkx/classes/reportviews.py
@@ -791,8 +791,7 @@ class OutMultiEdgeDataView(OutEdgeDataView):
                         if data in dd else (n, nbr, default)
 
     def __len__(self):
-        return sum(len(kd) for n, nbrs in self._nodes_nbrs()
-                   for nbr, kd in nbrs.items())
+        return sum(1 for e in self)
 
     def __iter__(self):
         return (self._report(n, nbr, k, dd) for n, nbrs in self._nodes_nbrs()
@@ -821,10 +820,6 @@ class MultiEdgeDataView(OutMultiEdgeDataView):
     """An EdgeDataView class for edges of MultiGraph; See EdgeDataView"""
     __slots__ = ()
 
-    def __len__(self):
-        # nbunch makes it hard to count edges between nodes in nbunch
-        return sum(1 for e in self)
-
     def __iter__(self):
         seen = {}
         for n, nbrs in self._nodes_nbrs():
@@ -1016,7 +1011,7 @@ class EdgeView(OutEdgeView):
     dataview = EdgeDataView
 
     def __len__(self):
-        return sum(len(nbrs) for n, nbrs in self._nodes_nbrs()) // 2
+        return sum(len(nbrs) + (n in nbrs) for n, nbrs in self._nodes_nbrs()) // 2
 
     def __iter__(self):
         seen = {}
@@ -1120,8 +1115,7 @@ class MultiEdgeView(OutMultiEdgeView):
     dataview = MultiEdgeDataView
 
     def __len__(self):
-        return sum(len(kdict) for n, nbrs in self._nodes_nbrs()
-                   for nbr, kdict in nbrs.items()) // 2
+        return sum(1 for e in self)
 
     def __iter__(self):
         seen = {}

len(G.edges) unexpected values
I'm not sure if this is a bug or expected behavior but it's at least confusing.  This is using 2.0 nx.Graph() - I would provide the data to recreate, but it's private and I'm not sure why this is occurring, which might just be my lack of knowledge
```
>>> len(G.edges())
300
>>> G.number_of_edges()
312
>>> count = 0
>>> s = set()
>>> for edge in G.edges():
...     seen = edge in s or (edge[1], edge[0]) in s
...     if not seen:
...         count += 1
...     s.add(edge)
>>> count
312
```
What would be likely reasons that len() would give a different answer than number_of_edges()?  I thought it was because of reversed edges, but that doesn't seem to be the case either.
diff --git a/networkx/classes/tests/test_reportviews.py b/networkx/classes/tests/test_reportviews.py
index a4a5c2c1a..7fd96d4dd 100644
--- a/networkx/classes/tests/test_reportviews.py
+++ b/networkx/classes/tests/test_reportviews.py
@@ -326,6 +326,12 @@ class TestEdgeDataView(object):
         assert_equal(len(self.G.edges()), 8)
         assert_equal(len(self.G.edges), 8)
 
+        H = self.G.copy()
+        H.add_edge(1, 1)
+        assert_equal(len(H.edges(1)), 3)
+        assert_equal(len(H.edges()), 9)
+        assert_equal(len(H.edges), 9)
+
 
 class TestOutEdgeDataView(TestEdgeDataView):
     def setUp(self):
@@ -351,6 +357,12 @@ class TestOutEdgeDataView(TestEdgeDataView):
         assert_equal(len(self.G.edges()), 8)
         assert_equal(len(self.G.edges), 8)
 
+        H = self.G.copy()
+        H.add_edge(1, 1)
+        assert_equal(len(H.edges(1)), 2)
+        assert_equal(len(H.edges()), 9)
+        assert_equal(len(H.edges), 9)
+
 
 class TestInEdgeDataView(TestOutEdgeDataView):
     def setUp(self):
@@ -486,6 +498,12 @@ class TestEdgeView(object):
         num_ed = 9 if self.G.is_multigraph() else 8
         assert_equal(len(ev), num_ed)
 
+        H = self.G.copy()
+        H.add_edge(1, 1)
+        assert_equal(len(H.edges(1)), 3 + H.is_multigraph() - H.is_directed())
+        assert_equal(len(H.edges()), num_ed + 1)
+        assert_equal(len(H.edges), num_ed + 1)
+
     def test_and(self):
         # print("G & H edges:", gnv & hnv)
         ev = self.eview(self.G)

pip install -e .
parse_log_pytest
requirements.txt
nose pytest
apt-get update apt-get install -y libgdal-dev graphviz
3.6
requirements/default.txt requirements/test.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
decorator==5.1.1
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/networkx/networkx.git@b271d45e1329ef65d888366c595c010070abe035#egg=networkx
nose==1.3.7
nose-ignore-docstring==0.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
requests==2.27.1
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: networkx
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - charset-normalizer==2.0.12
      - codecov==2.1.13
      - coverage==6.2
      - decorator==5.1.1
      - idna==3.10
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - nose==1.3.7
      - nose-ignore-docstring==0.2
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - requests==2.27.1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/networkx

networkx/classes/tests/test_reportviews.py::TestEdgeView::test_len networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_len
networkx/classes/tests/test_reportviews.py::TestNodeViewSetOps::test_len networkx/classes/tests/test_reportviews.py::TestNodeViewSetOps::test_and networkx/classes/tests/test_reportviews.py::TestNodeViewSetOps::test_or networkx/classes/tests/test_reportviews.py::TestNodeViewSetOps::test_xor networkx/classes/tests/test_reportviews.py::TestNodeViewSetOps::test_sub networkx/classes/tests/test_reportviews.py::TestNodeDataViewSetOps::test_len networkx/classes/tests/test_reportviews.py::TestNodeDataViewSetOps::test_and networkx/classes/tests/test_reportviews.py::TestNodeDataViewSetOps::test_or networkx/classes/tests/test_reportviews.py::TestNodeDataViewSetOps::test_xor networkx/classes/tests/test_reportviews.py::TestNodeDataViewSetOps::test_sub networkx/classes/tests/test_reportviews.py::TestNodeDataViewDefaultSetOps::test_len networkx/classes/tests/test_reportviews.py::TestNodeDataViewDefaultSetOps::test_and networkx/classes/tests/test_reportviews.py::TestNodeDataViewDefaultSetOps::test_or networkx/classes/tests/test_reportviews.py::TestNodeDataViewDefaultSetOps::test_xor networkx/classes/tests/test_reportviews.py::TestNodeDataViewDefaultSetOps::test_sub networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_str networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_repr networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_iterdata networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_iter networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestEdgeDataView::test_len networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_str networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_iterdata networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_iter networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_repr networkx/classes/tests/test_reportviews.py::TestOutEdgeDataView::test_len networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_str networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_iterdata networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_iter networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_len networkx/classes/tests/test_reportviews.py::TestInEdgeDataView::test_repr networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_str networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_iterdata networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_iter networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_len networkx/classes/tests/test_reportviews.py::TestMultiEdgeDataView::test_repr networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_str networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_iterdata networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_iter networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_len networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeDataView::test_repr networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_str networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_iterdata networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_iter networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_len networkx/classes/tests/test_reportviews.py::TestInMultiEdgeDataView::test_repr
networkx/classes/tests/test_reportviews.py::TestNodeView::test_pickle networkx/classes/tests/test_reportviews.py::TestNodeView::test_str networkx/classes/tests/test_reportviews.py::TestNodeView::test_repr networkx/classes/tests/test_reportviews.py::TestNodeView::test_contains networkx/classes/tests/test_reportviews.py::TestNodeView::test_getitem networkx/classes/tests/test_reportviews.py::TestNodeView::test_iter networkx/classes/tests/test_reportviews.py::TestNodeView::test_call networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_viewtype networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_pickle networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_str networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_repr networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_contains networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_getitem networkx/classes/tests/test_reportviews.py::TestNodeDataView::test_iter networkx/classes/tests/test_reportviews.py::test_nodedataview_unhashable networkx/classes/tests/test_reportviews.py::TestEdgeView::test_pickle networkx/classes/tests/test_reportviews.py::TestEdgeView::test_str networkx/classes/tests/test_reportviews.py::TestEdgeView::test_repr networkx/classes/tests/test_reportviews.py::TestEdgeView::test_call networkx/classes/tests/test_reportviews.py::TestEdgeView::test_data networkx/classes/tests/test_reportviews.py::TestEdgeView::test_iter networkx/classes/tests/test_reportviews.py::TestEdgeView::test_contains networkx/classes/tests/test_reportviews.py::TestEdgeView::test_and networkx/classes/tests/test_reportviews.py::TestEdgeView::test_or networkx/classes/tests/test_reportviews.py::TestEdgeView::test_xor networkx/classes/tests/test_reportviews.py::TestEdgeView::test_sub networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_pickle networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_str networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_call networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_data networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_iter networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_contains networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_len networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_and networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_or networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_xor networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_sub networkx/classes/tests/test_reportviews.py::TestOutEdgeView::test_repr networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_pickle networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_str networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_call networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_data networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_iter networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_contains networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_len networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_and networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_or networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_xor networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_sub networkx/classes/tests/test_reportviews.py::TestInEdgeView::test_repr networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_pickle networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_contains networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_str networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_repr networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_call networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_data networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_iter networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_iterkeys networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_or networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_sub networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_xor networkx/classes/tests/test_reportviews.py::TestMultiEdgeView::test_and networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_pickle networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_contains networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_len networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_str networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_call networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_data networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_iter networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_iterkeys networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_or networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_sub networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_xor networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_and networkx/classes/tests/test_reportviews.py::TestOutMultiEdgeView::test_repr networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_pickle networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_contains networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_len networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_str networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_call networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_data networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_iter networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_iterkeys networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_or networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_sub networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_xor networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_and networkx/classes/tests/test_reportviews.py::TestInMultiEdgeView::test_repr networkx/classes/tests/test_reportviews.py::TestDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestDiDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestOutDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestInDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestMultiDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestDiMultiDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestOutMultiDegreeView::test_weight networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_pickle networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_iter networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_len networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_str networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_repr networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_nbunch networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_getitem networkx/classes/tests/test_reportviews.py::TestInMultiDegreeView::test_weight
networkx/classes/reportviews.py
networkx/classes/reportviews.py