codecov[bot]: # [Codecov](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=h1) Report
> Merging [#226](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=desc) into [master](https://codecov.io/gh/pydata/sparse/commit/b7381b4298878ae1642d679e4b129cadb43302f4?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pydata/sparse/pull/226/graphs/tree.svg?width=650&token=H212u0Uxxw&height=150&src=pr)](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #226   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files          11       11           
  Lines        1549     1549           
=======================================
  Hits         1512     1512           
  Misses         37       37
```


| [Impacted Files](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [sparse/coo/core.py](https://codecov.io/gh/pydata/sparse/pull/226/diff?src=pr&el=tree#diff-c3BhcnNlL2Nvby9jb3JlLnB5) | `96.71% <100%> (ø)` | :arrow_up: |
| [sparse/dok.py](https://codecov.io/gh/pydata/sparse/pull/226/diff?src=pr&el=tree#diff-c3BhcnNlL2Rvay5weQ==) | `95.57% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=footer). Last update [b7381b4...1bf2e3a](https://codecov.io/gh/pydata/sparse/pull/226?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

diff --git a/sparse/coo/core.py b/sparse/coo/core.py
index 71fe0d5..727df16 100644
--- a/sparse/coo/core.py
+++ b/sparse/coo/core.py
@@ -479,11 +479,9 @@ class COO(SparseArray, NDArrayOperatorsMixin):
             ndim = 0 if shape is None else len(shape)
             coords = np.empty((ndim, 0), dtype=np.uint8)
             data = np.empty((0,))
+            shape = () if shape is None else shape
 
-            return COO(coords, data, shape=() if shape is None else shape,
-                       sorted=True, has_duplicates=False)
-
-        if not isinstance(x[0][0], Iterable):
+        elif not isinstance(x[0][0], Iterable):
             coords = np.stack(x[1], axis=0)
             data = np.asarray(x[0])
         else:
diff --git a/sparse/dok.py b/sparse/dok.py
index b4f1233..1351cbd 100644
--- a/sparse/dok.py
+++ b/sparse/dok.py
@@ -125,7 +125,7 @@ class DOK(SparseArray):
     def _make_shallow_copy_of(self, other):
         self.dtype = other.dtype
         self.data = other.data
-        super(DOK, self).__init__(other.shape)
+        super(DOK, self).__init__(other.shape, fill_value=other.fill_value)
 
     @classmethod
     def from_coo(cls, x):

Bug in converting from DOK to COO
I originally noticed this bug when I tried the following, 

`sparse.DOK.from_coo(sparse.ones((2,2), dtype=bool)).to_coo().todense()`.

It yields 

```
array([[0., 0.],
       [0., 0.]])
```

However, the issue is even more basic for example the following:

`sparse.DOK.from_coo(sparse.ones((2,2))).to_coo().todense()`,

yields the same result,

```
array([[0., 0.],
       [0., 0.]])
```

The correct results ought to be 

```
array([[True, True],
       [True, True]])
```

and 

```
array([[1., 1.],
       [1., 1.]])
```
diff --git a/sparse/tests/test_dok.py b/sparse/tests/test_dok.py
index 2443f33..e9d3d4a 100644
--- a/sparse/tests/test_dok.py
+++ b/sparse/tests/test_dok.py
@@ -169,3 +169,11 @@ def test_asformat(format):
     s2 = s.asformat(format)
 
     assert_eq(s, s2)
+
+
+def test_coo_fv_interface():
+    s1 = sparse.full((5, 5), fill_value=1+np.random.rand())
+    s2 = sparse.DOK(s1)
+    assert_eq(s1, s2)
+    s3 = sparse.COO(s2)
+    assert_eq(s1, s3)

pip install -e .[all]
parse_log_pytest
requirements.txt
pytest pytest-flake8 pytest-cov
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
asv==0.5.1
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
Jinja2==3.0.3
llvmlite==0.36.0
MarkupSafe==2.0.1
mccabe==0.7.0
numba==0.53.1
numpy==1.19.5
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-flake8==1.1.1
pytz==2025.2
requests==2.27.1
scipy==1.5.4
six==1.17.0
snowballstemmer==2.2.0
-e git+https://github.com/pydata/sparse.git@b7381b4298878ae1642d679e4b129cadb43302f4#egg=sparse
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
zipp==3.6.0

name: sparse
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:
      - alabaster==0.7.13
      - asv==0.5.1
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - coverage==6.2
      - distlib==0.3.9
      - docutils==0.17.1
      - filelock==3.4.1
      - flake8==5.0.4
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - importlib-resources==5.4.0
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - llvmlite==0.36.0
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - numba==0.53.1
      - numpy==1.19.5
      - packaging==21.3
      - platformdirs==2.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - pytest-flake8==1.1.1
      - pytz==2025.2
      - requests==2.27.1
      - scipy==1.5.4
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinx-rtd-theme==1.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - toml==0.10.2
      - tomli==1.2.3
      - tox==3.28.0
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - virtualenv==20.16.2
      - zipp==3.6.0
prefix: /opt/conda/envs/sparse

sparse/tests/test_dok.py::test_setitem[shape0-index0-0.8044249966383981] sparse/tests/test_dok.py::test_setitem[shape1-index1-0.9624453454864889] sparse/tests/test_dok.py::test_setitem[shape3-1-0.26343557000568685] sparse/tests/test_dok.py::test_setitem[shape4-index4-0.3145223774756446] sparse/tests/test_dok.py::test_setitem[shape5-index5-0.3921629111396877] sparse/tests/test_dok.py::test_setitem[shape9-index9-0.41477857662173867] sparse/tests/test_dok.py::test_setitem[shape11-index11-0.28263695337480843] sparse/tests/test_dok.py::test_setitem[shape13-index13-0.6158029884379906] sparse/tests/test_dok.py::test_coo_fv_interface
sparse/tests/test_dok.py::flake-8::FLAKE8
sparse/tests/test_dok.py::test_random_shape_nnz[0.1-shape0] sparse/tests/test_dok.py::test_random_shape_nnz[0.1-shape1] sparse/tests/test_dok.py::test_random_shape_nnz[0.1-shape2] sparse/tests/test_dok.py::test_random_shape_nnz[0.3-shape0] sparse/tests/test_dok.py::test_random_shape_nnz[0.3-shape1] sparse/tests/test_dok.py::test_random_shape_nnz[0.3-shape2] sparse/tests/test_dok.py::test_random_shape_nnz[0.5-shape0] sparse/tests/test_dok.py::test_random_shape_nnz[0.5-shape1] sparse/tests/test_dok.py::test_random_shape_nnz[0.5-shape2] sparse/tests/test_dok.py::test_random_shape_nnz[0.7-shape0] sparse/tests/test_dok.py::test_random_shape_nnz[0.7-shape1] sparse/tests/test_dok.py::test_random_shape_nnz[0.7-shape2] sparse/tests/test_dok.py::test_convert_to_coo sparse/tests/test_dok.py::test_convert_from_coo sparse/tests/test_dok.py::test_convert_from_numpy sparse/tests/test_dok.py::test_convert_to_numpy sparse/tests/test_dok.py::test_construct[2-data0] sparse/tests/test_dok.py::test_construct[shape1-data1] sparse/tests/test_dok.py::test_construct[shape2-data2] sparse/tests/test_dok.py::test_getitem[0.1-shape0] sparse/tests/test_dok.py::test_getitem[0.1-shape1] sparse/tests/test_dok.py::test_getitem[0.1-shape2] sparse/tests/test_dok.py::test_getitem[0.3-shape0] sparse/tests/test_dok.py::test_getitem[0.3-shape1] sparse/tests/test_dok.py::test_getitem[0.3-shape2] sparse/tests/test_dok.py::test_getitem[0.5-shape0] sparse/tests/test_dok.py::test_getitem[0.5-shape1] sparse/tests/test_dok.py::test_getitem[0.5-shape2] sparse/tests/test_dok.py::test_getitem[0.7-shape0] sparse/tests/test_dok.py::test_getitem[0.7-shape1] sparse/tests/test_dok.py::test_getitem[0.7-shape2] sparse/tests/test_dok.py::test_setitem[shape2-index2-value2] sparse/tests/test_dok.py::test_setitem[shape6-index6-value6] sparse/tests/test_dok.py::test_setitem[shape7-index7-value7] sparse/tests/test_dok.py::test_setitem[shape8-index8-value8] sparse/tests/test_dok.py::test_setitem[shape10-index10-value10] sparse/tests/test_dok.py::test_setitem[shape12-index12-value12] sparse/tests/test_dok.py::test_default_dtype sparse/tests/test_dok.py::test_int_dtype sparse/tests/test_dok.py::test_float_dtype sparse/tests/test_dok.py::test_set_zero sparse/tests/test_dok.py::test_asformat[coo] sparse/tests/test_dok.py::test_asformat[dok]
sparse/coo/core.py sparse/dok.py
sparse/coo/core.py sparse/dok.py