@@ -22,7 +22,6 @@ class TestSolution(unittest.TestCase):
22
22
"""
23
23
24
24
def tearDown (self ) -> None :
25
- Solution .reset_instance ()
26
25
return super ().tearDown ()
27
26
28
27
@patch ('sys.stdout' , new_callable = StringIO )
@@ -89,7 +88,6 @@ def test_main(self, mock_stdout: StringIO) -> None:
89
88
Solution .main ()
90
89
expected : str = 'wrong\n wrong\n wrong\n right\n '
91
90
self .assertEqual (mock_stdout .getvalue (), expected )
92
- # Solution.reset_instance()
93
91
94
92
def test_data (self ) -> None :
95
93
"""Tests data property
@@ -99,35 +97,14 @@ def test_data(self) -> None:
99
97
sol = Solution (sys .stdin )
100
98
self .assertEqual (
101
99
sol .data , [[2 , 3 , 4 ], [20 , 50 , 62 ], [3 , 4 , 7 ]])
102
- # Solution.reset_instance()
103
100
104
101
def test_singleton (self ) -> None :
105
- """Tests singleton property
106
- """
107
- data = '2 3 4\n 20 50 62\n 3 4 7\n 0 0 0\n '
108
- with patch ('sys.stdin' , StringIO (data )):
109
- _ = Solution (sys .stdin )
110
- with self .assertRaises (NameError ):
111
- _ = Solution (sys .stdin )
112
- # self.assertIs(instance1, instance2)
113
- # Solution.reset_instance()
114
-
115
- def test_get_instance (self ) -> None :
116
102
"""Tests get_instance method
117
103
"""
118
- data = '2 3 4\n 20 50 62\n 3 4 7\n 0 0 0\n '
119
- with patch ('sys.stdin' , StringIO (data )):
120
- instance1 = Solution (sys .stdin )
121
- instance2 = Solution .get_instance ()
122
- self .assertIs (instance1 , instance2 )
123
-
124
- def test_set_instance (self ) -> None :
125
- """Tests set_instance method
126
- """
127
- data = '2 3 4\n 20 50 62\n 3 4 7\n 0 0 0\n '
128
- with patch ('sys.stdin' , StringIO (data )):
104
+ data1 = '2 3 4\n 20 50 62\n 3 4 7\n 0 0 0\n '
105
+ data2 = '20 30 40\n 200 500 620\n 30 40 70\n 0 0 0\n '
106
+ with patch ('sys.stdin' , StringIO (data1 )):
129
107
instance1 = Solution (sys .stdin )
130
- instance2 = Solution .get_instance ()
131
- self .assertIs (instance1 , instance2 )
132
- Solution .reset_instance ()
133
- self .assertIsNone (Solution ._instance )
108
+ with patch ('sys.stdin' , StringIO (data2 )):
109
+ instance2 = Solution (sys .stdin )
110
+ self .assertIs (instance1 , instance2 )
0 commit comments