Exemplo n.º 1
0
 def test_repr_helper(self):
     """ Test repr_helper. """
     self.assertEqual("A", util.repr_helper("A"))
     self.assertEqual("5", util.repr_helper(5))
     self.assertEqual("True", util.repr_helper(True))
     self.assertEqual("test=1", util.repr_helper({"test": 1}))
     self.assertEqual("12:00:00 09-07-1986", util.repr_helper(datetime(1986, 7, 9, 12, 0, 0)))
Exemplo n.º 2
0
 def test_repr_helper(self):
     """Test repr_helper."""
     self.assertEqual("A", util.repr_helper("A"))
     self.assertEqual("5", util.repr_helper(5))
     self.assertEqual("True", util.repr_helper(True))
     self.assertEqual("test=1", util.repr_helper({"test": 1}))
     self.assertEqual("1986-07-09T12:00:00+00:00",
                      util.repr_helper(datetime(1986, 7, 9, 12, 0, 0)))
Exemplo n.º 3
0
def test_repr_helper():
    """Test repr_helper."""
    assert util.repr_helper("A") == "A"
    assert util.repr_helper(5) == "5"
    assert util.repr_helper(True) == "True"
    assert util.repr_helper({"test": 1}) == "test=1"
    assert (util.repr_helper(datetime(1986, 7, 9, 12, 0,
                                      0)) == "1986-07-09T12:00:00+00:00")
Exemplo n.º 4
0
 def test_repr_helper(self):
     """Test repr_helper."""
     assert "A" == util.repr_helper("A")
     assert "5" == util.repr_helper(5)
     assert "True" == util.repr_helper(True)
     assert "test=1" == util.repr_helper({"test": 1})
     assert "1986-07-09T12:00:00+00:00" == \
         util.repr_helper(datetime(1986, 7, 9, 12, 0, 0))
Exemplo n.º 5
0
def test_repr_helper():
    """Test repr_helper."""
    assert util.repr_helper("A") == 'A'
    assert util.repr_helper(5) == '5'
    assert util.repr_helper(True) == 'True'
    assert util.repr_helper({"test": 1}) == 'test=1'
    assert util.repr_helper(datetime(1986, 7, 9, 12, 0, 0)) == \
        '1986-07-09T12:00:00+00:00'
Exemplo n.º 6
0
 def test_repr_helper(self):
     """Test repr_helper."""
     assert "A" == util.repr_helper("A")
     assert "5" == util.repr_helper(5)
     assert "True" == util.repr_helper(True)
     assert "test=1" == util.repr_helper({"test": 1})
     assert "1986-07-09T12:00:00+00:00" == \
         util.repr_helper(datetime(1986, 7, 9, 12, 0, 0))
Exemplo n.º 7
0
def test_repr_helper():
    """Test repr_helper."""
    assert util.repr_helper("A") == "A"
    assert util.repr_helper(5) == "5"
    assert util.repr_helper(True) == "True"
    assert util.repr_helper({"test": 1}) == "test=1"

    tz = dt_util.get_time_zone("Europe/Copenhagen")
    with patch("homeassistant.util.dt.DEFAULT_TIME_ZONE", tz):
        assert (util.repr_helper(datetime(1986, 7, 9, 12, 0,
                                          0)) == "1986-07-09T12:00:00+02:00")
Exemplo n.º 8
0
    def __repr__(self):
        """Return the representation of the states."""
        attr = "; {}".format(util.repr_helper(self.attributes)) if self.attributes else ""

        return "<state {}={}{} @ {}>".format(
            self.entity_id, self.state, attr, dt_util.as_local(self.last_changed).isoformat()
        )
Exemplo n.º 9
0
 def __repr__(self):
     """Return the representation."""
     # pylint: disable=maybe-no-member
     if self.data:
         return "<Event {}[{}]: {}>".format(self.event_type, str(self.origin)[0], util.repr_helper(self.data))
     else:
         return "<Event {}[{}]>".format(self.event_type, str(self.origin)[0])
Exemplo n.º 10
0
    def __repr__(self):
        attr = "; {}".format(util.repr_helper(self.attributes)) \
               if self.attributes else ""

        return "<state {}={}{} @ {}>".format(
            self.entity_id, self.state, attr,
            dt_util.datetime_to_local_str(self.last_changed))
Exemplo n.º 11
0
 def __repr__(self):
     """Return the represenation of the service."""
     if self.data:
         return "<ServiceCall {}.{}: {}>".format(
             self.domain, self.service, util.repr_helper(self.data))
     else:
         return "<ServiceCall {}.{}>".format(self.domain, self.service)
Exemplo n.º 12
0
    def __repr__(self):
        attr = "; {}".format(util.repr_helper(self.attributes)) \
               if self.attributes else ""

        return "<state {}={}{} @ {}>".format(
            self.entity_id, self.state, attr,
            util.datetime_to_str(self.last_changed))
Exemplo n.º 13
0
 def __repr__(self):
     """Return the represenation of the service."""
     if self.data:
         return "<ServiceCall {}.{}: {}>".format(
             self.domain, self.service, util.repr_helper(self.data))
     else:
         return "<ServiceCall {}.{}>".format(self.domain, self.service)
Exemplo n.º 14
0
 def __repr__(self):
     if self.attributes:
         return "<state {}:{} @ {}>".format(
             self.state, util.repr_helper(self.attributes),
             util.datetime_to_str(self.last_changed))
     else:
         return "<state {} @ {}>".format(
             self.state, util.datetime_to_str(self.last_changed))
Exemplo n.º 15
0
 def __repr__(self):
     if self.attributes:
         return "<state {}:{} @ {}>".format(
             self.state, util.repr_helper(self.attributes),
             util.datetime_to_str(self.last_changed))
     else:
         return "<state {} @ {}>".format(
             self.state, util.datetime_to_str(self.last_changed))
Exemplo n.º 16
0
    def __repr__(self) -> str:
        """Return the representation of the states."""
        attrs = "; {}".format(util.repr_helper(self.attributes)) \
            if self.attributes else ""

        return "<state {}={}{} @ {}>".format(
            self.entity_id, self.state, attrs,
            dt_util.as_local(self.last_changed).isoformat())
Exemplo n.º 17
0
    def __repr__(self) -> str:
        """Return the representation of the service."""
        if self.data:
            return "<ServiceCall {}.{} (c:{}): {}>".format(
                self.domain, self.service, self.context.id,
                util.repr_helper(self.data))

        return f"<ServiceCall {self.domain}.{self.service} (c:{self.context.id})>"
Exemplo n.º 18
0
    def __repr__(self) -> str:
        """Return the representation of the service."""
        if self.data:
            return "<ServiceCall {}.{} (c:{}): {}>".format(
                self.domain, self.service, self.context.id,
                util.repr_helper(self.data))

        return "<ServiceCall {}.{} (c:{})>".format(
            self.domain, self.service, self.context.id)
Exemplo n.º 19
0
    def __repr__(self) -> str:
        """Return the representation."""
        # pylint: disable=maybe-no-member
        if self.data:
            return "<Event {}[{}]: {}>".format(self.event_type,
                                               str(self.origin)[0],
                                               util.repr_helper(self.data))

        return "<Event {}[{}]>".format(self.event_type, str(self.origin)[0])
Exemplo n.º 20
0
 def __repr__(self):
     # pylint: disable=maybe-no-member
     if self.data:
         return "<Event {}[{}]: {}>".format(
             self.event_type, self.origin.value[0],
             util.repr_helper(self.data))
     else:
         return "<Event {}[{}]>".format(self.event_type,
                                        self.origin.value[0])
Exemplo n.º 21
0
 def __repr__(self):
     # pylint: disable=maybe-no-member
     if self.data:
         return "<Event {}[{}]: {}>".format(
             self.event_type, str(self.origin)[0],
             util.repr_helper(self.data))
     else:
         return "<Event {}[{}]>".format(self.event_type,
                                        str(self.origin)[0])
Exemplo n.º 22
0
 def __repr__(self):
     if self.data:
         return "<ServiceCall {}.{}: {}>".format(
             self.domain, self.service, util.repr_helper(self.data))
     else:
         return "<ServiceCall {}.{}>".format(self.domain, self.service)
Exemplo n.º 23
0
 def __repr__(self):
     if self.data:
         return "<ServiceCall {}.{}: {}>".format(
             self.domain, self.service, util.repr_helper(self.data))
     else:
         return "<ServiceCall {}.{}>".format(self.domain, self.service)