MCPcopy Index your code
hub / github.com/bleachbit/bleachbit / _test_encoding

Method _test_encoding

tests/TestDeepScan.py:29–58  ·  view source on GitHub ↗

Test encoding

(self, fn)

Source from the content-addressed store, hash-verified

27 """Test Case for module DeepScan"""
28
29 def _test_encoding(self, fn):
30 """Test encoding"""
31
32 fullpath = self.write_file(fn + ".bak")
33
34 # Add Unicode paths to encourage a crash.
35 subdir = os.path.join(self.tempdir, 'ɡælɪk.dir')
36 os.mkdir(subdir)
37 subfile = os.path.join(subdir, 'ɡælɪk.file')
38 common.touch_file(subfile)
39
40 searches = {self.tempdir: []}
41 searches[self.tempdir].append(
42 Search(command='delete', regex=r'\.[Bb][Aa][Kk]$'))
43 ds = DeepScan(searches)
44 found = False
45 for cmd in ds.scan():
46 if cmd == True:
47 # True is used to yield to GTK+, but it is not
48 # needed in this test.
49 continue
50 self.assertExists(cmd.path)
51 if cmd.path == fullpath:
52 found = True
53 self.assertTrue(found, "Did not find '%s'" % fullpath)
54
55 os.unlink(fullpath)
56 self.assertNotExists(fullpath)
57
58 shutil.rmtree(subdir)
59
60 def test_encoding(self):
61 """Test encoding"""

Callers 1

test_encodingMethod · 0.95

Calls 7

scanMethod · 0.95
DeepScanClass · 0.90
write_fileMethod · 0.80
joinMethod · 0.80
mkdirMethod · 0.80
assertExistsMethod · 0.80
assertNotExistsMethod · 0.80

Tested by

no test coverage detected