Skip to content

Commit

Permalink
Code review: 279560043: Changed assertEqual with None into assertIsNone.
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Dec 27, 2015
1 parent f184701 commit ade84d2
Show file tree
Hide file tree
Showing 60 changed files with 438 additions and 438 deletions.
4 changes: 2 additions & 2 deletions config/dpkg/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python-dfvfs (20151226-1) unstable; urgency=low
python-dfvfs (20151227-1) unstable; urgency=low

* Auto-generated

-- Log2Timeline <[email protected]> Sat, 26 Dec 2015 15:41:22 +0100
-- Log2Timeline <[email protected]> Sun, 27 Dec 2015 12:25:31 +0100
2 changes: 1 addition & 1 deletion dfvfs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '20151226'
__version__ = '20151227'
2 changes: 1 addition & 1 deletion tests/compression/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def testGetDecompressor(self):
decompressor_object, zlib_decompressor.ZlibDecompressor)

decompressor_object = manager.CompressionManager.GetDecompressor(u'bogus')
self.assertEqual(decompressor_object, None)
self.assertIsNone(decompressor_object)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/encoding/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def testGetDecoder(self):
self.assertIsInstance(decoder_object, base16_decoder.Base16Decoder)

decoder_object = manager.EncodingManager.GetDecoder(u'bogus')
self.assertEqual(decoder_object, None)
self.assertIsNone(decoder_object)


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/file_io/gzip_file_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def testOpenClosePathSpec(self):
self.assertEqual(file_object.modification_time, 0x501416d7)
self.assertEqual(file_object.operating_system, 0x03)
self.assertEqual(file_object.original_filename, u'syslog.1')
self.assertEqual(file_object.comment, None)
self.assertIsNone(file_object.comment)

file_object.close()

Expand Down
16 changes: 8 additions & 8 deletions tests/helpers/file_system_searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def testFind(self):
find_spec = file_system_searcher.FindSpec(
file_entry_types=[definitions.FILE_ENTRY_TYPE_FILE])
path_spec_generator = searcher.Find(find_specs=[find_spec])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = [
u'/$AttrDef',
Expand Down Expand Up @@ -87,7 +87,7 @@ def testFind(self):
find_spec = file_system_searcher.FindSpec(
file_entry_types=[definitions.FILE_ENTRY_TYPE_DIRECTORY])
path_spec_generator = searcher.Find(find_specs=[find_spec])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = [
u'/',
Expand All @@ -108,7 +108,7 @@ def testFind(self):
find_spec = file_system_searcher.FindSpec(
file_entry_types=[definitions.FILE_ENTRY_TYPE_LINK])
path_spec_generator = searcher.Find(find_specs=[find_spec])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = []

Expand All @@ -127,7 +127,7 @@ def testFind(self):
location=u'/PASSWORD.TXT')
path_spec_generator = searcher.Find(
find_specs=[find_spec1, find_spec2, find_spec3])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = [
u'/$Extend/$RmMetadata',
Expand All @@ -143,7 +143,7 @@ def testFind(self):
find_spec = file_system_searcher.FindSpec(
location=u'/PASSWORD.TXT', case_sensitive=False)
path_spec_generator = searcher.Find(find_specs=[find_spec])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = [
u'/password.txt']
Expand All @@ -169,7 +169,7 @@ def testFind(self):
location_regex=u'/PASSWORD.TXT')
path_spec_generator = searcher.Find(
find_specs=[find_spec1, find_spec2, find_spec3])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = [
u'/$Extend/$RmMetadata',
Expand All @@ -186,7 +186,7 @@ def testFind(self):
find_spec = file_system_searcher.FindSpec(
location_regex=u'/PASSWORD.TXT', case_sensitive=False)
path_spec_generator = searcher.Find(find_specs=[find_spec])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = [
u'/password.txt']
Expand All @@ -205,7 +205,7 @@ def testFind(self):
find_spec = file_system_searcher.FindSpec(
location_regex=location, case_sensitive=False)
path_spec_generator = searcher.Find(find_specs=[find_spec])
self.assertNotEqual(path_spec_generator, None)
self.assertIsNotNone(path_spec_generator)

expected_locations = sorted([
os.path.join(self._os_path, u'syslog.base16'),
Expand Down
52 changes: 26 additions & 26 deletions tests/helpers/source_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_STORAGE_MEDIA_IMAGE)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertIsNotNone(scan_node)
self.assertEqual(
scan_node.type_indicator, definitions.TYPE_INDICATOR_TSK_PARTITION)

Expand All @@ -74,7 +74,7 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_STORAGE_MEDIA_IMAGE)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertIsNotNone(scan_node)
self.assertEqual(scan_node.type_indicator, definitions.TYPE_INDICATOR_QCOW)
self.assertEqual(len(scan_node.sub_nodes), 2)

Expand Down Expand Up @@ -109,14 +109,14 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_STORAGE_MEDIA_IMAGE)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertIsNotNone(scan_node)
self.assertEqual(scan_node.type_indicator, definitions.TYPE_INDICATOR_RAW)

for scan_node in scan_node.sub_nodes:
if getattr(scan_node.path_spec, u'location', None) == None:
break

self.assertNotEqual(scan_node, None)
self.assertIsNotNone(scan_node)
self.assertEqual(scan_node.type_indicator, definitions.TYPE_INDICATOR_BDE)
self.assertEqual(len(scan_node.sub_nodes), 0)

Expand All @@ -130,7 +130,7 @@ def testScan(self):
if getattr(scan_node.path_spec, u'location', None) == u'/':
break

self.assertNotEqual(scan_node.path_spec, None)
self.assertIsNotNone(scan_node.path_spec)
self.assertEqual(scan_node.type_indicator, definitions.TYPE_INDICATOR_TSK)

test_file = os.path.join(u'test_data', u'testdir_os')
Expand All @@ -142,8 +142,8 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_DIRECTORY)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertNotEqual(scan_node.path_spec, None)
self.assertIsNotNone(scan_node)
self.assertIsNotNone(scan_node.path_spec)
self.assertEqual(
scan_node.type_indicator, definitions.TYPE_INDICATOR_OS)

Expand All @@ -156,8 +156,8 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_FILE)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertNotEqual(scan_node.path_spec, None)
self.assertIsNotNone(scan_node)
self.assertIsNotNone(scan_node.path_spec)
self.assertEqual(
scan_node.type_indicator, definitions.TYPE_INDICATOR_OS)

Expand All @@ -170,8 +170,8 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_FILE)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertNotEqual(scan_node.path_spec, None)
self.assertIsNotNone(scan_node)
self.assertIsNotNone(scan_node.path_spec)
self.assertEqual(
scan_node.type_indicator, definitions.TYPE_INDICATOR_OS)

Expand All @@ -184,8 +184,8 @@ def testScan(self):
scan_context.source_type, definitions.SOURCE_TYPE_STORAGE_MEDIA_IMAGE)

scan_node = self._GetTestScanNode(scan_context)
self.assertNotEqual(scan_node, None)
self.assertNotEqual(scan_node.path_spec, None)
self.assertIsNotNone(scan_node)
self.assertIsNotNone(scan_node.path_spec)
self.assertEqual(scan_node.type_indicator, definitions.TYPE_INDICATOR_TSK)

self.assertEqual(len(scan_node.sub_nodes), 0)
Expand All @@ -206,7 +206,7 @@ def testScanForFileSystem(self):
store_index=1, parent=source_path_spec)

path_spec = self._source_scanner.ScanForFileSystem(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)

expected_type_indicator = definitions.PREFERRED_NTFS_BACK_END
self.assertEqual(path_spec.type_indicator, expected_type_indicator)
Expand All @@ -215,68 +215,68 @@ def testScanForFileSystem(self):
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForFileSystem(source_path_spec)
self.assertEqual(path_spec, None)
self.assertIsNone(path_spec)

def testScanForStorageMediaImage(self):
"""Test the ScanForStorageMediaImage() function."""
test_file = os.path.join(u'test_data', u'ímynd.dd')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(path_spec.type_indicator, definitions.TYPE_INDICATOR_RAW)

test_file = os.path.join(u'test_data', u'image.raw.000')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(path_spec.type_indicator, definitions.TYPE_INDICATOR_RAW)

test_file = os.path.join(u'test_data', u'image.E01')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(path_spec.type_indicator, definitions.TYPE_INDICATOR_EWF)

test_file = os.path.join(u'test_data', u'image.qcow2')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(
path_spec.type_indicator, definitions.TYPE_INDICATOR_QCOW)

test_file = os.path.join(u'test_data', u'image.vhd')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(
path_spec.type_indicator, definitions.TYPE_INDICATOR_VHDI)

test_file = os.path.join(u'test_data', u'image.vmdk')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(
path_spec.type_indicator, definitions.TYPE_INDICATOR_VMDK)

test_file = os.path.join(u'test_data', u'mactime.body')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForStorageMediaImage(source_path_spec)
self.assertEqual(path_spec, None)
self.assertIsNone(path_spec)

def testScanForVolumeSystem(self):
"""Test the ScanForVolumeSystem() function."""
test_file = os.path.join(u'test_data', u'tsk_volume_system.raw')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForVolumeSystem(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(
path_spec.type_indicator, definitions.TYPE_INDICATOR_TSK_PARTITION)

Expand All @@ -285,22 +285,22 @@ def testScanForVolumeSystem(self):
source_path_spec = qcow_path_spec.QcowPathSpec(parent=source_path_spec)

path_spec = self._source_scanner.ScanForVolumeSystem(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(
path_spec.type_indicator, definitions.TYPE_INDICATOR_VSHADOW)

test_file = os.path.join(u'test_data', u'bdetogo.raw')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForVolumeSystem(source_path_spec)
self.assertNotEqual(path_spec, None)
self.assertIsNotNone(path_spec)
self.assertEqual(path_spec.type_indicator, definitions.TYPE_INDICATOR_BDE)

test_file = os.path.join(u'test_data', u'mactime.body')
source_path_spec = os_path_spec.OSPathSpec(location=test_file)

path_spec = self._source_scanner.ScanForVolumeSystem(source_path_spec)
self.assertEqual(path_spec, None)
self.assertIsNone(path_spec)


if __name__ == '__main__':
Expand Down
Loading

0 comments on commit ade84d2

Please sign in to comment.