Exemple #1
0
 def value_as_trytes(self):
     # type: () -> TryteString
     """
 Returns a TryteString representation of the transaction's value.
 """
     # Note that we are padding to 81 _trits_.
     return TryteString.from_trits(trits_from_int(self.value, pad=81))
Exemple #2
0
    def test_zero(self):
        """
    Zero is represented as ``[0]`` by default.

    https://github.com/iotaledger/iota.py/issues/49
    """
        self.assertEqual(trits_from_int(0), [0])
Exemple #3
0
  def test_zero(self):
    """
    Zero is represented as ``[0]`` by default.

    https://github.com/iotaledger/iota.lib.py/issues/49
    """
    self.assertEqual(trits_from_int(0), [0])
Exemple #4
0
 def last_index_as_trytes(self):
     # type: () -> TryteString
     """
 Returns a TryteString representation of the transaction's
 ``last_index`` value.
 """
     # Note that we are padding to 27 _trits_.
     return TryteString.from_trits(trits_from_int(self.last_index, pad=27))
Exemple #5
0
 def timestamp_as_trytes(self):
     # type: () -> TryteString
     """
 Returns a TryteString representation of the transaction's
 timestamp.
 """
     # Note that we are padding to 27 _trits_.
     return TryteString.from_trits(trits_from_int(self.timestamp, pad=27))
Exemple #6
0
 def test_zero_unpadded(self):
     """
 Converting zero to trits, without padding.
 """
     self.assertEqual(trits_from_int(0, pad=None), [])
Exemple #7
0
def int_to_trytestring(int_input, length):
    trits = trits_from_int(int(int_input))
    trytes = TryteString.from_trits(trits)
    if len(trytes) < length:
        trytes += '9' * (length - len(trytes))
    return trytes
Exemple #8
0
 def test_zero_unpadded(self):
   """
   Converting zero to trits, without padding.
   """
   self.assertEqual(trits_from_int(0, pad=None), [])