File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/python
22# -*- coding: utf-8 -*-
33
4+ import sys
45import unittest
5- from unittest .mock import patch , mock_open
6+
7+ if sys .version_info [0 ] < 3 :
8+ import mock
9+ else :
10+ from unittest import mock
611
712from bs4 import BeautifulSoup
813
@@ -135,8 +140,8 @@ def test_return_list(self):
135140 )
136141
137142
138- @patch ('csv.writer' )
139- @patch ('html_table_extractor.extractor.open' )
143+ @mock . patch ('csv.writer' )
144+ @mock . patch ('html_table_extractor.extractor.open' )
140145class TestWriteToCsv (unittest .TestCase ):
141146 def setUp (self ):
142147 html = """
@@ -153,7 +158,7 @@ def setUp(self):
153158 """
154159 self .extractor = Extractor (html )
155160 self .extractor .parse ()
156- mock_open ()
161+ mock . mock_open ()
157162
158163 def test_write_to_csv_default (self , csv_mock , _ ):
159164 self .extractor .write_to_csv ()
You can’t perform that action at this time.
0 commit comments