def test_propclass_store(mocker): mocker.patch('time.localtime', return_value=time.localtime(1478550580)) p = Properties({"key": "value"}) s = StringIO() p.store(s) assert s.getvalue() == '#Mon Nov 07 15:29:40 EST 2016\nkey=value\n' time.localtime.assert_called_once_with(None)
def test_propclass_empty(fixed_timestamp): p = Properties() assert len(p) == 0 assert not bool(p) assert dict(p) == {} s = StringIO() p.store(s) assert s.getvalue() == '#' + fixed_timestamp + '\n'
def test_propclass_empty_setitem(fixed_timestamp): p = Properties() p["key"] = "value" assert len(p) == 1 assert bool(p) assert dict(p) == {"key": "value"} s = StringIO() p.store(s) assert s.getvalue() == '#' + fixed_timestamp + '\nkey=value\n'
def test_propclass_empty(mocker): mocker.patch('time.localtime', return_value=time.localtime(1478550580)) p = Properties() assert len(p) == 0 assert not bool(p) assert dict(p) == {} s = StringIO() p.store(s) assert s.getvalue() == '#Mon Nov 07 15:29:40 EST 2016\n' time.localtime.assert_called_once_with(None)
def test_propclass_empty_setitem(mocker): mocker.patch('time.localtime', return_value=time.localtime(1478550580)) p = Properties() p["key"] = "value" assert len(p) == 1 assert bool(p) assert dict(p) == {"key": "value"} s = StringIO() p.store(s) assert s.getvalue() == '#Mon Nov 07 15:29:40 EST 2016\nkey=value\n' time.localtime.assert_called_once_with(None)
def test_propclass_store_defaults(fixed_timestamp): defs = Properties({"key": "lock", "horse": "orange"}) p = Properties({"key": "value"}, defaults=defs) s = StringIO() p.store(s) assert s.getvalue() == '#' + fixed_timestamp + '\nkey=value\n'
def test_propclass_store_comment(fixed_timestamp): p = Properties({"key": "value"}) s = StringIO() p.store(s, comments='Testing') assert s.getvalue() == \ '#Testing\n#' + fixed_timestamp + '\nkey=value\n'
def test_propclass_store(fixed_timestamp): p = Properties({"key": "value"}) s = StringIO() p.store(s) assert s.getvalue() == '#' + fixed_timestamp + '\nkey=value\n'