예제 #1
0
    def testDirectory(self):
        entry = jobs_pb2.StatEntry()
        entry.pathspec.path = '/foo/bar'
        entry.st_size = 42
        entry.st_mode = 16877

        out = io.StringIO()
        pp = pretty.PrettyPrinter(out)
        representer.stat_entry_pretty(entry, pp, cycle=False)

        expected = '📂 bar (drwxr-xr-x /foo/bar, {})'
        expected = expected.format(humanize.naturalsize(42))

        self.assertEqual(out.getvalue(), expected)
예제 #2
0
  def testFile(self):
    entry = jobs_pb2.StatEntry()
    entry.pathspec.path = '/foo/bar'
    entry.st_size = 42
    entry.st_mode = 33188

    out = StringIO()
    pp = pretty.PrettyPrinter(out)
    representer.stat_entry_pretty(entry, pp, cycle=False)

    expected = '📄 bar (-rw-r--r-- /foo/bar, {})'
    expected = expected.format(humanize.naturalsize(42))

    self.assertEqual(out.getvalue(), expected)