Skip to content

Commit 9862d28

Browse files
authoredNov 12, 2024··
Merge pull request #45 from pyrox0/dev
nose -> pytest
2 parents 661d4f0 + ca3548c commit 9862d28

17 files changed

+118
-126
lines changed
 

‎.github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
python-version: [3.6, 3.7, 3.8, 3.9]
11-
os: [macOs-latest, ubuntu-latest, windows-latest]
10+
python-version: [3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12]
11+
os: [macos-latest, ubuntu-latest, windows-latest]
1212

1313
runs-on: ${{ matrix.os }}
1414
name: run tests
@@ -25,8 +25,8 @@ jobs:
2525
- name: test
2626
run: |
2727
pip freeze
28-
nosetests --verbosity=3 --with-coverage --cover-package pyexcel_ods --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst docs/source pyexcel_ods
28+
pytest
2929
- name: Upload coverage
3030
uses: codecov/codecov-action@v1
3131
with:
32-
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
32+
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

‎README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ and update CHANGELOG.rst.
353353
How to test your contribution
354354
------------------------------
355355

356-
Although `nose` and `doctest` are both used in code testing, it is adviable that unit tests are put in tests. `doctest` is incorporated only to make sure the code examples in documentation remain valid across different development releases.
356+
Although `pytest` and `doctest` are both used in code testing, it is adviable that unit tests are put in tests. `doctest` is incorporated only to make sure the code examples in documentation remain valid across different development releases.
357357

358358
On Linux/Unix systems, please launch your tests like this::
359359

‎pyexcel_ods/odsr.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:copyright: (c) 2014-2020 by Onni Software Ltd.
88
:license: New BSD License, see LICENSE for more details
99
"""
10+
1011
# Copyright 2011 Marco Conti
1112

1213
# Licensed under the Apache License, Version 2.0 (the "License");

‎pyexcel_ods/odsw.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:copyright: (c) 2014-2020 by Onni Software Ltd.
88
:license: New BSD License, see LICENSE for more details
99
"""
10+
1011
import pyexcel_io.service as converter
1112
from odf.text import P
1213
from odf.table import Table, TableRow, TableCell

‎pytest.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = --cov=pyexcel_ods --doctest-glob="*.rst" tests/ README.rst docs/source pyexcel_ods

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def filter_out_test_code(file_handle):
193193
keywords=KEYWORDS,
194194
python_requires=PYTHON_REQUIRES,
195195
extras_require=EXTRAS_REQUIRE,
196-
tests_require=["nose"],
196+
tests_require=["pytest", "pytest-cov"],
197197
install_requires=INSTALL_REQUIRES,
198198
packages=PACKAGES,
199199
include_package_data=True,

‎test.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
pip freeze
2-
nosetests --with-coverage --cover-package pyexcel_ods --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst docs/source pyexcel_ods
2+
pytest

‎test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#/bin/bash
22
pip freeze
3-
nosetests --with-coverage --cover-package pyexcel_ods --cover-package tests tests --with-doctest --doctest-extension=.rst README.rst docs/source pyexcel_ods
3+
pytest

‎tests/base.py

+32-34
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import os # noqa
22
import datetime # noqa
33

4+
import pytest
45
import pyexcel
56

6-
from nose.tools import eq_, raises # noqa
7-
87

98
def create_sample_file1(file):
109
data = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 1.1, 1]
@@ -29,7 +28,7 @@ class PyexcelHatWriterBase:
2928
def test_series_table(self):
3029
pyexcel.save_as(adict=self.content, dest_file_name=self.testfile)
3130
r = pyexcel.get_sheet(file_name=self.testfile, name_columns_by_row=0)
32-
eq_(r.dict, self.content)
31+
assert r.dict == self.content
3332

3433

3534
class PyexcelWriterBase:
@@ -83,7 +82,7 @@ def test_reading_through_sheets(self):
8382
expected = [[4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6]]
8483
assert data == expected
8584
data = list(b["Sheet3"].rows())
86-
expected = [[u"X", u"Y", u"Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]
85+
expected = [["X", "Y", "Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]
8786
assert data == expected
8887
sheet3 = b["Sheet3"]
8988
sheet3.name_columns_by_row(0)
@@ -96,46 +95,45 @@ class ODSCellTypes:
9695
def test_formats(self):
9796
# date formats
9897
date_format = "%d/%m/%Y"
99-
eq_(self.data["Sheet1"][0][0], "Date")
100-
eq_(self.data["Sheet1"][1][0].strftime(date_format), "11/11/2014")
101-
eq_(self.data["Sheet1"][2][0].strftime(date_format), "01/01/2001")
102-
eq_(self.data["Sheet1"][3][0], "")
98+
assert self.data["Sheet1"][0][0] == "Date"
99+
assert self.data["Sheet1"][1][0].strftime(date_format) == "11/11/2014"
100+
assert self.data["Sheet1"][2][0].strftime(date_format) == "01/01/2001"
101+
assert self.data["Sheet1"][3][0] == ""
103102
# time formats
104103
time_format = "%S:%M:%H"
105-
eq_(self.data["Sheet1"][0][1], "Time")
106-
eq_(self.data["Sheet1"][1][1].strftime(time_format), "12:12:11")
107-
eq_(self.data["Sheet1"][2][1].strftime(time_format), "12:00:00")
108-
eq_(self.data["Sheet1"][3][1], 0)
109-
eq_(
110-
self.data["Sheet1"][4][1],
111-
datetime.timedelta(hours=27, minutes=17, seconds=54),
104+
assert self.data["Sheet1"][0][1] == "Time"
105+
assert self.data["Sheet1"][1][1].strftime(time_format) == "12:12:11"
106+
assert self.data["Sheet1"][2][1].strftime(time_format) == "12:00:00"
107+
assert self.data["Sheet1"][3][1] == 0
108+
assert self.data["Sheet1"][4][1] == datetime.timedelta(
109+
hours=27, minutes=17, seconds=54
112110
)
113-
eq_(self.data["Sheet1"][5][1], "Other")
111+
assert self.data["Sheet1"][5][1] == "Other"
114112
# boolean
115-
eq_(self.data["Sheet1"][0][2], "Boolean")
116-
eq_(self.data["Sheet1"][1][2], True)
117-
eq_(self.data["Sheet1"][2][2], False)
113+
assert self.data["Sheet1"][0][2] == "Boolean"
114+
assert self.data["Sheet1"][1][2] == True
115+
assert self.data["Sheet1"][2][2] == False
118116
# Float
119-
eq_(self.data["Sheet1"][0][3], "Float")
120-
eq_(self.data["Sheet1"][1][3], 11.11)
117+
assert self.data["Sheet1"][0][3] == "Float"
118+
assert self.data["Sheet1"][1][3] == 11.11
121119
# Currency
122-
eq_(self.data["Sheet1"][0][4], "Currency")
123-
eq_(self.data["Sheet1"][1][4], "1 GBP")
124-
eq_(self.data["Sheet1"][2][4], "-10000 GBP")
120+
assert self.data["Sheet1"][0][4] == "Currency"
121+
assert self.data["Sheet1"][1][4] == "1 GBP"
122+
assert self.data["Sheet1"][2][4] == "-10000 GBP"
125123
# Percentage
126-
eq_(self.data["Sheet1"][0][5], "Percentage")
127-
eq_(self.data["Sheet1"][1][5], 2)
124+
assert self.data["Sheet1"][0][5] == "Percentage"
125+
assert self.data["Sheet1"][1][5] == 2
128126
# int
129-
eq_(self.data["Sheet1"][0][6], "Int")
130-
eq_(self.data["Sheet1"][1][6], 3)
131-
eq_(self.data["Sheet1"][4][6], 11)
127+
assert self.data["Sheet1"][0][6] == "Int"
128+
assert self.data["Sheet1"][1][6] == 3
129+
assert self.data["Sheet1"][4][6] == 11
132130
# Scientifed not supported
133-
eq_(self.data["Sheet1"][1][7], 100000)
131+
assert self.data["Sheet1"][1][7] == 100000
134132
# Fraction
135-
eq_(self.data["Sheet1"][1][8], 1.25)
133+
assert self.data["Sheet1"][1][8] == 1.25
136134
# Text
137-
eq_(self.data["Sheet1"][1][9], "abc")
135+
assert self.data["Sheet1"][1][9] == "abc"
138136

139-
@raises(IndexError)
140137
def test_no_excessive_trailing_columns(self):
141-
eq_(self.data["Sheet1"][2][6], "")
138+
with pytest.raises(IndexError):
139+
assert self.data["Sheet1"][2][6] == ""

‎tests/requirements.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
nose
2-
mock;python_version<"3"
1+
pytest
2+
pytest-cov
33
codecov
4-
coverage
54
flake8
65
black
76
isort

‎tests/test_bug_fixes.py

+34-36
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,81 @@
33
import os
44

55
import psutil
6+
import pytest
67
import pyexcel as pe
78
from pyexcel_ods import get_data, save_data
89
from pyexcel_io.exceptions import IntegerAccuracyLossError
910

10-
from nose import SkipTest
11-
from nose.tools import eq_, raises
12-
1311
IN_TRAVIS = "TRAVIS" in os.environ
1412

1513

1614
def test_bug_fix_for_issue_1():
1715
data = get_data(get_fixtures("repeated.ods"))
18-
eq_(data["Sheet1"], [["repeated", "repeated", "repeated", "repeated"]])
16+
assert data["Sheet1"] == [["repeated", "repeated", "repeated", "repeated"]]
1917

2018

2119
def test_bug_fix_for_issue_2():
2220
data = {}
2321
data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
24-
data.update({"Sheet 2": [[u"row 1", u"Héllô!", u"HolÁ!"]]})
22+
data.update({"Sheet 2": [["row 1", "Héllô!", "HolÁ!"]]})
2523
save_data("your_file.ods", data)
2624
new_data = get_data("your_file.ods")
27-
assert new_data["Sheet 2"] == [[u"row 1", u"H\xe9ll\xf4!", u"Hol\xc1!"]]
25+
assert new_data["Sheet 2"] == [["row 1", "H\xe9ll\xf4!", "Hol\xc1!"]]
2826

2927

30-
@raises(Exception)
3128
def test_invalid_date():
32-
from pyexcel_ods.ods import date_value
33-
34-
value = "2015-08-"
35-
date_value(value)
29+
with pytest.raises(Exception):
30+
from pyexcel_ods.ods import date_value
3631

32+
value = "2015-08-"
33+
date_value(value)
3734

38-
@raises(Exception)
39-
def test_fake_date_time_10():
40-
from pyexcel_ods.ods import date_value
35+
with pytest.raises(Exception):
36+
from pyexcel_ods.ods import date_value
4137

42-
date_value("1234567890")
38+
date_value("1234567890")
4339

4440

45-
@raises(Exception)
4641
def test_fake_date_time_19():
47-
from pyexcel_ods.ods import date_value
42+
with pytest.raises(Exception):
43+
from pyexcel_ods.ods import date_value
4844

49-
date_value("1234567890123456789")
45+
date_value("1234567890123456789")
5046

5147

52-
@raises(Exception)
5348
def test_fake_date_time_20():
54-
from pyexcel_ods.ods import date_value
49+
with pytest.raises(Exception):
50+
from pyexcel_ods.ods import date_value
5551

56-
date_value("12345678901234567890")
52+
date_value("12345678901234567890")
5753

5854

5955
def test_issue_13():
6056
test_file = "test_issue_13.ods"
6157
data = [[1, 2], [], [], [], [3, 4]]
6258
save_data(test_file, {test_file: data})
6359
written_data = get_data(test_file, skip_empty_rows=False)
64-
eq_(data, written_data[test_file])
60+
assert data == written_data[test_file]
6561
os.unlink(test_file)
6662

6763

6864
def test_issue_14():
6965
# pyexcel issue 61
7066
test_file = "issue_61.ods"
7167
data = get_data(get_fixtures(test_file), skip_empty_rows=True)
72-
eq_(data["S-LMC"], [[u"aaa"], [0]])
68+
assert data["S-LMC"] == [["aaa"], [0]]
7369

7470

7571
def test_issue_6():
7672
test_file = "12_day_as_time.ods"
7773
data = get_data(get_fixtures(test_file), skip_empty_rows=True)
78-
eq_(data["Sheet1"][0][0].days, 12)
74+
assert data["Sheet1"][0][0].days == 12
7975

8076

8177
def test_issue_19():
8278
test_file = "pyexcel_81_ods_19.ods"
8379
data = get_data(get_fixtures(test_file), skip_empty_rows=True)
84-
eq_(data["product.template"][1][1], "PRODUCT NAME PMP")
80+
assert data["product.template"][1][1] == "PRODUCT NAME PMP"
8581

8682

8783
def test_issue_83_ods_file_handle():
@@ -110,18 +106,20 @@ def test_issue_83_ods_file_handle():
110106
pe.free_resources()
111107
open_files_l4 = proc.open_files()
112108
# this confirms that no more open file handle
113-
eq_(open_files_l1, open_files_l4)
109+
assert open_files_l1 == open_files_l4
114110

115111

116112
def test_pr_22():
117113
test_file = get_fixtures("white_space.ods")
118114
data = get_data(test_file)
119-
eq_(data["Sheet1"][0][0], "paragraph with tab(\t), space, \nnew line")
115+
assert (
116+
data["Sheet1"][0][0] == "paragraph with tab(\t), space, \nnew line"
117+
)
120118

121119

122120
def test_issue_23():
123121
if not IN_TRAVIS:
124-
raise SkipTest()
122+
pytest.skip("Need to be in Travis CI to run this test.")
125123
pe.get_book(
126124
url=(
127125
"https://github.com/pyexcel/pyexcel-ods/"
@@ -133,13 +131,13 @@ def test_issue_23():
133131
def test_issue_24():
134132
test_file = get_fixtures("comment-in-cell.ods")
135133
data = get_data(test_file)
136-
eq_(data["Sheet1"], [["test"]])
134+
assert data["Sheet1"] == [["test"]]
137135

138136

139137
def test_issue_27():
140138
test_file = get_fixtures("issue_27.ods")
141139
data = get_data(test_file, skip_empty_rows=True)
142-
eq_(data["VGPMX"], [["", "Cost Basis", "0"]])
140+
assert data["VGPMX"] == [["", "Cost Basis", "0"]]
143141

144142

145143
def test_issue_30():
@@ -148,16 +146,16 @@ def test_issue_30():
148146
sheet[0, 0] = 999999999999999
149147
sheet.save_as(test_file)
150148
sheet2 = pe.get_sheet(file_name=test_file)
151-
eq_(sheet[0, 0], sheet2[0, 0])
149+
assert sheet[0, 0] == sheet2[0, 0]
152150
os.unlink(test_file)
153151

154152

155-
@raises(IntegerAccuracyLossError)
156153
def test_issue_30_precision_loss():
157-
test_file = "issue_30_2.ods"
158-
sheet = pe.Sheet()
159-
sheet[0, 0] = 9999999999999999
160-
sheet.save_as(test_file)
154+
with pytest.raises(IntegerAccuracyLossError):
155+
test_file = "issue_30_2.ods"
156+
sheet = pe.Sheet()
157+
sheet[0, 0] = 9999999999999999
158+
sheet.save_as(test_file)
161159

162160

163161
def get_fixtures(filename):

‎tests/test_filter.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
from pyexcel_io import get_data, save_data
44

5-
from nose.tools import eq_
6-
75

86
class TestFilter:
9-
def setUp(self):
7+
def setup_method(self):
108
self.test_file = "test_filter.ods"
119
sample = [
1210
[1, 21, 31],
@@ -24,21 +22,21 @@ def test_filter_row(self):
2422
self.test_file, start_row=3, library="pyexcel-ods"
2523
)
2624
expected = [[4, 24, 34], [5, 25, 35], [6, 26, 36]]
27-
eq_(filtered_data[self.sheet_name], expected)
25+
assert filtered_data[self.sheet_name] == expected
2826

2927
def test_filter_row_2(self):
3028
filtered_data = get_data(
3129
self.test_file, start_row=3, row_limit=1, library="pyexcel-ods"
3230
)
3331
expected = [[4, 24, 34]]
34-
eq_(filtered_data[self.sheet_name], expected)
32+
assert filtered_data[self.sheet_name] == expected
3533

3634
def test_filter_column(self):
3735
filtered_data = get_data(
3836
self.test_file, start_column=1, library="pyexcel-ods"
3937
)
4038
expected = [[21, 31], [22, 32], [23, 33], [24, 34], [25, 35], [26, 36]]
41-
eq_(filtered_data[self.sheet_name], expected)
39+
assert filtered_data[self.sheet_name] == expected
4240

4341
def test_filter_column_2(self):
4442
filtered_data = get_data(
@@ -48,14 +46,14 @@ def test_filter_column_2(self):
4846
library="pyexcel-ods",
4947
)
5048
expected = [[21], [22], [23], [24], [25], [26]]
51-
eq_(filtered_data[self.sheet_name], expected)
49+
assert filtered_data[self.sheet_name] == expected
5250

5351
def test_filter_both_ways(self):
5452
filtered_data = get_data(
5553
self.test_file, start_column=1, start_row=3, library="pyexcel-ods"
5654
)
5755
expected = [[24, 34], [25, 35], [26, 36]]
58-
eq_(filtered_data[self.sheet_name], expected)
56+
assert filtered_data[self.sheet_name] == expected
5957

6058
def test_filter_both_ways_2(self):
6159
filtered_data = get_data(
@@ -67,7 +65,7 @@ def test_filter_both_ways_2(self):
6765
library="pyexcel-ods",
6866
)
6967
expected = [[24]]
70-
eq_(filtered_data[self.sheet_name], expected)
68+
assert filtered_data[self.sheet_name] == expected
7169

72-
def tearDown(self):
70+
def teardown_method(self):
7371
os.unlink(self.test_file)

‎tests/test_formatters.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33

44
import pyexcel as pe
55

6-
from nose.tools import eq_
7-
86

97
class TestAutoDetectInt:
10-
def setUp(self):
8+
def setup_method(self):
119
self.content = [[1, 2, 3.1]]
1210
self.test_file = "test_auto_detect_init.ods"
1311
pe.save_as(array=self.content, dest_file_name=self.test_file)
@@ -21,7 +19,7 @@ def test_auto_detect_int(self):
2119
| 1 | 2 | 3.1 |
2220
+---+---+-----+"""
2321
).strip()
24-
eq_(str(sheet), expected)
22+
assert str(sheet) == expected
2523

2624
def test_get_book_auto_detect_int(self):
2725
book = pe.get_book(file_name=self.test_file, library="pyexcel-ods")
@@ -32,7 +30,7 @@ def test_get_book_auto_detect_int(self):
3230
| 1 | 2 | 3.1 |
3331
+---+---+-----+"""
3432
).strip()
35-
eq_(str(book), expected)
33+
assert str(book) == expected
3634

3735
def test_auto_detect_int_false(self):
3836
sheet = pe.get_sheet(
@@ -47,7 +45,7 @@ def test_auto_detect_int_false(self):
4745
| 1.0 | 2.0 | 3.1 |
4846
+-----+-----+-----+"""
4947
).strip()
50-
eq_(str(sheet), expected)
48+
assert str(sheet) == expected
5149

5250
def test_get_book_auto_detect_int_false(self):
5351
book = pe.get_book(
@@ -62,7 +60,7 @@ def test_get_book_auto_detect_int_false(self):
6260
| 1.0 | 2.0 | 3.1 |
6361
+-----+-----+-----+"""
6462
).strip()
65-
eq_(str(book), expected)
63+
assert str(book) == expected
6664

67-
def tearDown(self):
65+
def teardown_method(self):
6866
os.unlink(self.test_file)

‎tests/test_multiple_sheets.py

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
import os
22
import sys
33

4+
import pytest
45
import pyexcel
56
from base import PyexcelMultipleSheetBase
67

7-
from nose.tools import raises
8-
98
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
109
from ordereddict import OrderedDict
1110
else:
1211
from collections import OrderedDict
1312

1413

1514
class TestOdsNxlsMultipleSheets(PyexcelMultipleSheetBase):
16-
def setUp(self):
15+
def setup_method(self):
1716
self.testfile = "multiple1.ods"
1817
self.testfile2 = "multiple1.xls"
1918
self.content = _produce_ordered_dict()
2019
self._write_test_file(self.testfile)
2120

22-
def tearDown(self):
21+
def teardown_method(self):
2322
self._clean_up()
2423

2524

2625
class TestXlsNOdsMultipleSheets(PyexcelMultipleSheetBase):
27-
def setUp(self):
26+
def setup_method(self):
2827
self.testfile = "multiple1.xls"
2928
self.testfile2 = "multiple1.ods"
3029
self.content = _produce_ordered_dict()
3130
self._write_test_file(self.testfile)
3231

33-
def tearDown(self):
32+
def teardown_method(self):
3433
self._clean_up()
3534

3635

@@ -46,7 +45,7 @@ def _write_test_file(self, file):
4645
self.rows = 3
4746
pyexcel.save_book_as(bookdict=self.content, dest_file_name=file)
4847

49-
def setUp(self):
48+
def setup_method(self):
5049
self.testfile = "multiple1.ods"
5150
self.testfile2 = "multiple1.xls"
5251
self.content = _produce_ordered_dict()
@@ -63,13 +62,13 @@ def test_load_a_single_sheet2(self):
6362
assert len(b1.sheet_names()) == 1
6463
assert b1["Sheet1"].to_array() == self.content["Sheet1"]
6564

66-
@raises(IndexError)
6765
def test_load_a_single_sheet3(self):
68-
pyexcel.get_book(file_name=self.testfile, sheet_index=10000)
66+
with pytest.raises(IndexError):
67+
pyexcel.get_book(file_name=self.testfile, sheet_index=10000)
6968

70-
@raises(ValueError)
7169
def test_load_a_single_sheet4(self):
72-
pyexcel.get_book(file_name=self.testfile, sheet_name="Not exist")
70+
with pytest.raises(ValueError):
71+
pyexcel.get_book(file_name=self.testfile, sheet_name="Not exist")
7372

7473
def test_delete_sheets(self):
7574
b1 = pyexcel.load_book(self.testfile)
@@ -218,15 +217,15 @@ def test_add_book_error(self):
218217
except TypeError:
219218
assert 1 == 1
220219

221-
def tearDown(self):
220+
def teardown_method(self):
222221
if os.path.exists(self.testfile):
223222
os.unlink(self.testfile)
224223
if os.path.exists(self.testfile2):
225224
os.unlink(self.testfile2)
226225

227226

228227
class TestMultiSheetReader:
229-
def setUp(self):
228+
def setup_method(self):
230229
self.testfile = "file_with_an_empty_sheet.ods"
231230

232231
def test_reader_with_correct_sheets(self):
@@ -241,6 +240,6 @@ def _produce_ordered_dict():
241240
data_dict.update({"Sheet1": [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]})
242241
data_dict.update({"Sheet2": [[4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6]]})
243242
data_dict.update(
244-
{"Sheet3": [[u"X", u"Y", u"Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]}
243+
{"Sheet3": [["X", "Y", "Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]}
245244
)
246245
return data_dict

‎tests/test_ods_reader.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class TestODSReader(ODSCellTypes):
10-
def setUp(self):
10+
def setup_method(self):
1111
r = Reader("ods")
1212
r.reader_class = ODSBook
1313
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
@@ -18,7 +18,7 @@ def setUp(self):
1818

1919

2020
class TestODSWriter(ODSCellTypes):
21-
def setUp(self):
21+
def setup_method(self):
2222
r = Reader("ods")
2323
r.reader_class = ODSBook
2424
r.open(os.path.join("tests", "fixtures", "ods_formats.ods"))
@@ -33,6 +33,6 @@ def setUp(self):
3333
for key in self.data.keys():
3434
self.data[key] = list(self.data[key])
3535

36-
def tearDown(self):
36+
def teardown_method(self):
3737
if os.path.exists(self.testfile):
3838
os.unlink(self.testfile)

‎tests/test_stringio.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import pyexcel
44
from base import create_sample_file1
55

6-
from nose.tools import eq_
7-
86

97
class TestStringIO:
108
def test_ods_stringio(self):
@@ -17,7 +15,7 @@ def test_ods_stringio(self):
1715
)
1816
result = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 1.1, 1]
1917
actual = list(r.enumerate())
20-
eq_(result, actual)
18+
assert result == actual
2119
if os.path.exists(testfile):
2220
os.unlink(testfile)
2321

@@ -29,4 +27,4 @@ def test_ods_output_stringio(self):
2927
)
3028
result = [1, 2, 3, 4, 5, 6]
3129
actual = list(r.enumerate())
32-
eq_(result, actual)
30+
assert result == actual

‎tests/test_writer.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_write_book(self):
1010
self.content = {
1111
"Sheet1": [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]],
1212
"Sheet2": [[4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6]],
13-
"Sheet3": [[u"X", u"Y", u"Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]],
13+
"Sheet3": [["X", "Y", "Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]],
1414
}
1515
self.testfile = "writer.ods"
1616
writer = Writer(self.testfile, "ods")
@@ -19,27 +19,27 @@ def test_write_book(self):
1919
content = get_data(self.testfile, library="pyexcel-ods")
2020
assert content == self.content
2121

22-
def tearDown(self):
22+
def teardown_method(self):
2323
if os.path.exists(self.testfile):
2424
os.unlink(self.testfile)
2525

2626

2727
class TestodsnCSVWriter(PyexcelWriterBase):
28-
def setUp(self):
28+
def setup_method(self):
2929
self.testfile = "test.ods"
3030
self.testfile2 = "test.csv"
3131

32-
def tearDown(self):
32+
def teardown_method(self):
3333
if os.path.exists(self.testfile):
3434
os.unlink(self.testfile)
3535
if os.path.exists(self.testfile2):
3636
os.unlink(self.testfile2)
3737

3838

3939
class TestodsHatWriter(PyexcelHatWriterBase):
40-
def setUp(self):
40+
def setup_method(self):
4141
self.testfile = "test.ods"
4242

43-
def tearDown(self):
43+
def teardown_method(self):
4444
if os.path.exists(self.testfile):
4545
os.unlink(self.testfile)

0 commit comments

Comments
 (0)
Please sign in to comment.