Example #1
0
 def testConversion(self):
     """ intAdlerToHex and hexAdlerToInt tests """
     # no arguments
     try:
         Adler.intAdlerToHex()
     except Exception, error:
         self.assertEqual(isinstance(error, TypeError), True)
Example #2
0
 def testConversion( self ):
   """ intAdlerToHex and hexAdlerToInt tests """
   # no arguments
   try:
     Adler.intAdlerToHex() #pylint: disable=no-value-for-parameter
   except Exception, error:
     self.assertEqual( isinstance(error, TypeError), True )
Example #3
0
 def testConversion(self):
     """ intAdlerToHex and hexAdlerToInt tests """
     # no arguments
     try:
         Adler.intAdlerToHex()  #pylint: disable=no-value-for-parameter
     except Exception, error:
         self.assertEqual(isinstance(error, TypeError), True)
Example #4
0
 def testConversion( self ):
   """ intAdlerToHex and hexAdlerToInt tests """
   # no arguments 
   try:
     Adler.intAdlerToHex()
   except Exception, error:
     self.assertEqual( isinstance(error, TypeError), True )
Example #5
0
 def testConversion(self):
     """intAdlerToHex and hexAdlerToInt tests"""
     # no arguments
     try:
         Adler.intAdlerToHex()  # pylint: disable=no-value-for-parameter
     except Exception as error:
         self.assertEqual(isinstance(error, TypeError), True)
     # wrong type of arg (should it really print out to stdout)
     self.assertEqual(Adler.intAdlerToHex("a"), False)
     # normal operation
     self.assertEqual(int(Adler.intAdlerToHex(1)), Adler.hexAdlerToInt(Adler.intAdlerToHex(1)))
     self.assertEqual(Adler.hexAdlerToInt("0x01"), int(Adler.intAdlerToHex(Adler.hexAdlerToInt("0x01"))))
Example #6
0
    # wrong argument type
    self.assertEqual( Adler.stringAdler([]), False )
    # empty string
    self.assertEqual( int(Adler.stringAdler("")), int(self.emptyAdler) )
    # all letters
    self.assertEqual( Adler.stringAdler(string.letters), self.lettersAdler )

  def testConversion( self ):
    """ intAdlerToHex and hexAdlerToInt tests """
    # no arguments
    try:
      Adler.intAdlerToHex() #pylint: disable=no-value-for-parameter
    except Exception, error:
      self.assertEqual( isinstance(error, TypeError), True )
    # wrong type of arg (should it really print out to stdout)
    self.assertEqual( Adler.intAdlerToHex("a"), False )
    # normal operation
    self.assertEqual( int(Adler.intAdlerToHex(1)),
                      Adler.hexAdlerToInt( Adler.intAdlerToHex(1) ) )
    self.assertEqual( Adler.hexAdlerToInt( "0x01" ),
                      int( Adler.intAdlerToHex( Adler.hexAdlerToInt( "0x01" ) ) ) )

  def testFileAdler( self ):
    """ fileAdler tests """
    # no args
    try:
      Adler.fileAdler() #pylint: disable=no-value-for-parameter
    except Exception as error:
      self.assertEqual( isinstance(error,TypeError ), True )
    # read-protected file
    self.assertEqual( Adler.fileAdler( "/root/.login" ), False )
Example #7
0
        # wrong argument type
        self.assertEqual(Adler.stringAdler([]), False)
        # empty string
        self.assertEqual(int(Adler.stringAdler("")), int(self.emptyAdler))
        # all letters
        self.assertEqual(Adler.stringAdler(string.letters), self.lettersAdler)

    def testConversion(self):
        """ intAdlerToHex and hexAdlerToInt tests """
        # no arguments
        try:
            Adler.intAdlerToHex()
        except Exception, error:
            self.assertEqual(isinstance(error, TypeError), True)
        # wrong type of arg (should it really print out to stdout)
        self.assertEqual(Adler.intAdlerToHex("a"), False)
        # normal operation
        self.assertEqual(int(Adler.intAdlerToHex(1)),
                         Adler.hexAdlerToInt(Adler.intAdlerToHex(1)))
        self.assertEqual(Adler.hexAdlerToInt("0x01"),
                         int(Adler.intAdlerToHex(Adler.hexAdlerToInt("0x01"))))

    def testFileAdler(self):
        """ fileAdler tests """
        # no args
        try:
            Adler.fileAdler()
        except Exception as error:
            self.assertEqual(isinstance(error, TypeError), True)
        # read-protected file
        self.assertEqual(Adler.fileAdler("/root/.login"), False)