Esempio n. 1
0
 def get_dimensions(self):
     with Assert.raises(NotImplementedError):
         self.writer.get_dimensions()
     writer = TerminalWriter(sys.__stdout__)
     with Assert.not_raising(NotImplementedError):
         dimensions = writer.get_dimensions()
     height, width = dimensions
     Assert.isinstance(height, int)
     Assert.isinstance(width, int)
     Assert(height) == dimensions.height
     Assert(width) == dimensions.width
Esempio n. 2
0
 def get_dimensions(self):
     with Assert.raises(NotImplementedError):
         self.writer.get_dimensions()
     writer = TerminalWriter(sys.__stdout__)
     with Assert.not_raising(NotImplementedError):
         dimensions = writer.get_dimensions()
     height, width = dimensions
     Assert.isinstance(height, int)
     Assert.isinstance(width, int)
     Assert(height) == dimensions.height
     Assert(width) == dimensions.width
Esempio n. 3
0
    def get_width(self):
        with Assert.not_raising(Exception):
            self.writer.get_width()
        writer = TerminalWriter(sys.__stdout__)
        Assert(writer.get_width()) == writer.get_dimensions()[1]

        writer = TerminalWriter(StringIO())
        os.environ['COLUMNS'] = '50'
        Assert(writer.get_width()) == 50
        del os.environ['COLUMNS']
        Assert(writer.get_width()) == TerminalWriter.default_width
        default_width = TerminalWriter.default_width
        Assert(writer.get_width(default_width + 1)) == default_width + 1
Esempio n. 4
0
    def get_width(self):
        with Assert.not_raising(Exception):
            self.writer.get_width()
        writer = TerminalWriter(sys.__stdout__)
        Assert(writer.get_width()) == writer.get_dimensions()[1]

        writer = TerminalWriter(StringIO())
        os.environ['COLUMNS'] = '50'
        Assert(writer.get_width()) == 50
        del os.environ['COLUMNS']
        Assert(writer.get_width()) == TerminalWriter.default_width
        default_width = TerminalWriter.default_width
        Assert(writer.get_width(default_width + 1)) == default_width + 1