Skip to content

Commit 758f3e5

Browse files
committed
auto-convert asserts with nose2pytest
1 parent d8953c8 commit 758f3e5

File tree

7 files changed

+28
-28
lines changed

7 files changed

+28
-28
lines changed

tests/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PyexcelHatWriterBase:
2929
def test_series_table(self):
3030
pyexcel.save_as(adict=self.content, dest_file_name=self.testfile)
3131
r = pyexcel.get_sheet(file_name=self.testfile, name_columns_by_row=0)
32-
eq_(r.dict, self.content)
32+
assert r.dict == self.content
3333

3434

3535
class PyexcelWriterBase:

tests/test_bug_fixes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ def test_issue_9_hidden_sheet():
4343
test_file = get_fixture("hidden_sheets.xls")
4444
book_dict = pe.get_book_dict(file_name=test_file)
4545
assert "hidden" not in book_dict
46-
eq_(book_dict["shown"], [["A", "B"]])
46+
assert book_dict["shown"] == [["A", "B"]]
4747

4848

4949
def test_issue_9_hidden_sheet_2():
5050
test_file = get_fixture("hidden_sheets.xls")
5151
book_dict = pe.get_book_dict(file_name=test_file, skip_hidden_sheets=False)
5252
assert "hidden" in book_dict
53-
eq_(book_dict["shown"], [["A", "B"]])
54-
eq_(book_dict["hidden"], [["a", "b"]])
53+
assert book_dict["shown"] == [["A", "B"]]
54+
assert book_dict["hidden"] == [["a", "b"]]
5555

5656

5757
def test_issue_10_generator_as_content():
@@ -104,7 +104,7 @@ def test_issue_151():
104104
skip_hidden_row_and_column=False,
105105
library="pyexcel-xls",
106106
)
107-
eq_("#N/A", s[0, 0])
107+
assert "#N/A" == s[0, 0]
108108

109109

110110
@raises(NotImplementedError)
@@ -119,7 +119,7 @@ def test_empty_book_pyexcel_issue_120():
119119
def test_pyexcel_issue_54():
120120
xlvalue = 41071.0
121121
date = xldate_to_python_date(xlvalue, 1)
122-
eq_(date, datetime.date(2016, 6, 12))
122+
assert date == datetime.date(2016, 6, 12)
123123

124124

125125
def get_fixture(file_name):

tests/test_filter.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ def test_filter_row(self):
2424
self.test_file, start_row=3, library="pyexcel-xls"
2525
)
2626
expected = [[4, 24, 34], [5, 25, 35], [6, 26, 36]]
27-
eq_(filtered_data[self.sheet_name], expected)
27+
assert filtered_data[self.sheet_name] == expected
2828

2929
def test_filter_row_2(self):
3030
filtered_data = get_data(
3131
self.test_file, start_row=3, row_limit=1, library="pyexcel-xls"
3232
)
3333
expected = [[4, 24, 34]]
34-
eq_(filtered_data[self.sheet_name], expected)
34+
assert filtered_data[self.sheet_name] == expected
3535

3636
def test_filter_column(self):
3737
filtered_data = get_data(
3838
self.test_file, start_column=1, library="pyexcel-xls"
3939
)
4040
expected = [[21, 31], [22, 32], [23, 33], [24, 34], [25, 35], [26, 36]]
41-
eq_(filtered_data[self.sheet_name], expected)
41+
assert filtered_data[self.sheet_name] == expected
4242

4343
def test_filter_column_2(self):
4444
filtered_data = get_data(
@@ -48,14 +48,14 @@ def test_filter_column_2(self):
4848
library="pyexcel-xls",
4949
)
5050
expected = [[21], [22], [23], [24], [25], [26]]
51-
eq_(filtered_data[self.sheet_name], expected)
51+
assert filtered_data[self.sheet_name] == expected
5252

5353
def test_filter_both_ways(self):
5454
filtered_data = get_data(
5555
self.test_file, start_column=1, start_row=3, library="pyexcel-xls"
5656
)
5757
expected = [[24, 34], [25, 35], [26, 36]]
58-
eq_(filtered_data[self.sheet_name], expected)
58+
assert filtered_data[self.sheet_name] == expected
5959

6060
def test_filter_both_ways_2(self):
6161
filtered_data = get_data(
@@ -67,7 +67,7 @@ def test_filter_both_ways_2(self):
6767
library="pyexcel-xls",
6868
)
6969
expected = [[24]]
70-
eq_(filtered_data[self.sheet_name], expected)
70+
assert filtered_data[self.sheet_name] == expected
7171

7272
def tearDown(self):
7373
os.unlink(self.test_file)

tests/test_formatters.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_reading_date_format(self):
2222
library="pyexcel-xls",
2323
)
2424
assert isinstance(r[1, 0], datetime.date)
25-
eq_(r[1, 0].strftime("%d/%m/%y"), "25/12/14")
25+
assert r[1, 0].strftime("%d/%m/%y") == "25/12/14"
2626
assert isinstance(r[1, 1], datetime.time) is True
2727
assert r[1, 1].strftime("%H:%M:%S") == "11:11:11"
2828
assert r[4, 0].strftime("%d/%m/%Y") == "01/01/1900"
@@ -76,7 +76,7 @@ def test_auto_detect_int(self):
7676
| 1 | 2 | 3.1 |
7777
+---+---+-----+"""
7878
).strip()
79-
eq_(str(sheet), expected)
79+
assert str(sheet) == expected
8080

8181
def test_get_book_auto_detect_int(self):
8282
book = pe.get_book(file_name=self.test_file, library="pyexcel-xls")
@@ -87,7 +87,7 @@ def test_get_book_auto_detect_int(self):
8787
| 1 | 2 | 3.1 |
8888
+---+---+-----+"""
8989
).strip()
90-
eq_(str(book), expected)
90+
assert str(book) == expected
9191

9292
def test_auto_detect_int_false(self):
9393
sheet = pe.get_sheet(
@@ -102,7 +102,7 @@ def test_auto_detect_int_false(self):
102102
| 1.0 | 2.0 | 3.1 |
103103
+-----+-----+-----+"""
104104
).strip()
105-
eq_(str(sheet), expected)
105+
assert str(sheet) == expected
106106

107107
def test_get_book_auto_detect_int_false(self):
108108
book = pe.get_book(
@@ -117,7 +117,7 @@ def test_get_book_auto_detect_int_false(self):
117117
| 1.0 | 2.0 | 3.1 |
118118
+-----+-----+-----+"""
119119
).strip()
120-
eq_(str(book), expected)
120+
assert str(book) == expected
121121

122122
def tearDown(self):
123123
os.unlink(self.test_file)

tests/test_hidden.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_simple_hidden_sheets():
1111
skip_hidden_row_and_column=True,
1212
)
1313
expected = [[1, 3], [7, 9]]
14-
eq_(data["Sheet1"], expected)
14+
assert data["Sheet1"] == expected
1515

1616

1717
def test_complex_hidden_sheets():
@@ -20,4 +20,4 @@ def test_complex_hidden_sheets():
2020
skip_hidden_row_and_column=True,
2121
)
2222
expected = [[1, 3, 5, 7, 9], [31, 33, 35, 37, 39], [61, 63, 65, 67]]
23-
eq_(data["Sheet1"], expected)
23+
assert data["Sheet1"] == expected

tests/test_merged_cells.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_merged_cells():
1313
library="pyexcel-xls",
1414
)
1515
expected = [[1, 2, 3], [1, 5, 6], [1, 8, 9], [10, 11, 11]]
16-
eq_(data["Sheet1"], expected)
16+
assert data["Sheet1"] == expected
1717

1818

1919
def test_complex_merged_cells():
@@ -32,7 +32,7 @@ def test_complex_merged_cells():
3232
[25, 25, 25, 25, 25, 25, 25, 25, 25, 25],
3333
[25, 25, 25, 25, 25, 25, 25, 25, 25, 25],
3434
]
35-
eq_(data["Sheet1"], expected)
35+
assert data["Sheet1"] == expected
3636

3737

3838
def test_exploration():
@@ -53,9 +53,9 @@ def test_exploration():
5353
[2],
5454
[2],
5555
]
56-
eq_(data["Sheet1"], expected_sheet1)
56+
assert data["Sheet1"] == expected_sheet1
5757
expected_sheet2 = [[3], [3], [3], [3, 4, 4, 4, 4, 4, 4], [3], [3], [3]]
58-
eq_(data["Sheet2"], expected_sheet2)
58+
assert data["Sheet2"] == expected_sheet2
5959
expected_sheet3 = [
6060
["", "", "", "", "", 2, 2, 2],
6161
[],
@@ -67,7 +67,7 @@ def test_exploration():
6767
["", "", "", 5],
6868
["", "", "", 5],
6969
]
70-
eq_(data["Sheet3"], expected_sheet3)
70+
assert data["Sheet3"] == expected_sheet3
7171

7272

7373
def test_merged_cell_class():
@@ -76,8 +76,8 @@ def test_merged_cell_class():
7676
merged_cell.register_cells(test_dict)
7777
keys = sorted(list(test_dict.keys()))
7878
expected = ["1-1", "1-2", "1-3", "2-1", "2-2", "2-3", "3-1", "3-2", "3-3"]
79-
eq_(keys, expected)
80-
eq_(merged_cell, test_dict["3-1"])
79+
assert keys == expected
80+
assert merged_cell == test_dict["3-1"]
8181

8282

8383
def get_fixture(file_name):

tests/test_stringio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_xls_stringio(self):
1717
)
1818
result = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 1.1, 1]
1919
actual = list(r.enumerate())
20-
eq_(result, actual)
20+
assert result == actual
2121
if os.path.exists(testfile):
2222
os.unlink(testfile)
2323

@@ -29,4 +29,4 @@ def test_xls_output_stringio(self):
2929
)
3030
result = [1, 2, 3, 4, 5, 6]
3131
actual = list(r.enumerate())
32-
eq_(result, actual)
32+
assert result == actual

0 commit comments

Comments
 (0)