Example #1
0
class tFile_iter(unittest.TestCase):
	input_file="file.cmap"
	def setUp(self):
		with open(self.input_file, "w"):
			self.obj=File_iter(self.input_file)
	def tearDown(self):
		os.remove(self.input_file)
	def test_init(self):
		self.assertEqual(open(self.input_file).name, self.obj.i_file.name)
	def test_iter(self):
		self.assertEqual(self.obj, self.obj.__iter__())
	def test_equal_none(self):
		other=None
		self.assertFalse(self.obj==other)
	def test_equal_diffClass(self):
		other=Mock(i_file=open(self.input_file))
		self.assertFalse(self.obj==other)

	def test_equal_diffFile(self):
		with open("other_file", "w") as other_file:
			other=File_iter("other_file")
		os.remove("other_file")

		self.assertFalse(self.obj==other)

	def test_equal_isEqual(self):
		other=File_iter(self.input_file)
		self.assertTrue(self.obj==other)
Example #2
0
	def setUp(self):
		with open(self.input_file, "w"):
			self.obj=File_iter(self.input_file)