summaryrefslogtreecommitdiff
path: root/src/net/ip.py
blob: c7e5ec7ecff0221aeb76b68aa3216e8f1aca9b96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class IP4Address(object):
    __slots__ = ('_value')
    name = 'tmwa::IP4Address'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        addr = self._value['_addr']
        addr = tuple(int(addr[i]) for i in range(4))
        return '%d.%d.%d.%d' % addr

    tests = [
            ('tmwa::IP4Address({1,2,3,4})', '1.2.3.4'),
    ]