40d27cde0edb705bfa742a2f784d7a67b1d16e81,tests/components/test_sun.py,TestSun,test_state_change,#TestSun#,119

Before Change


        setup_component(self.hass, sun.DOMAIN, {
            sun.DOMAIN: {sun.CONF_ELEVATION: 0}})

        if sun.is_on(self.hass):
            test_state = sun.STATE_BELOW_HORIZON
            test_time = sun.next_setting(self.hass)
        else:
            test_state = sun.STATE_ABOVE_HORIZON
            test_time = sun.next_rising(self.hass)

        self.assertIsNotNone(test_time)

        self.hass.bus.fire(ha.EVENT_TIME_CHANGED,
                           {ha.ATTR_NOW: test_time + timedelta(seconds=5)})

After Change


    def test_state_change(self):
        Test if the state changes at next setting/rising.
        now = datetime(2016, 6, 1, 8, 0, 0, tzinfo=dt_util.UTC)
        with patch("homeassistant.helpers.condition.dt_util.utcnow",
                   return_value=now):
            setup_component(self.hass, sun.DOMAIN, {
                sun.DOMAIN: {sun.CONF_ELEVATION: 0}})

        self.hass.block_till_done()

        test_time = dt_util.parse_datetime(
            self.hass.states.get(sun.ENTITY_ID)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: home-assistant/home-assistant
Commit Name: 40d27cde0edb705bfa742a2f784d7a67b1d16e81
Time: 2017-05-09
Author: adam@armills.info
File Name: tests/components/test_sun.py
Class Name: TestSun
Method Name: test_state_change


Project Name: home-assistant/home-assistant
Commit Name: cfc23b0091d55b53eef9654fe0e9134ac12b8c38
Time: 2015-09-12
Author: paulus@paulusschoutsen.nl
File Name: tests/components/test_history.py
Class Name: TestComponentHistory
Method Name: test_get_states


Project Name: streamlit/streamlit
Commit Name: d32ecf41fbcfd2b050cf14a76638a9e5b9e5345a
Time: 2019-10-08
Author: tconkling@gmail.com
File Name: lib/tests/streamlit/credentials_test.py
Class Name: CredentialsClassTest
Method Name: test_Credentials_save