def test_log_serialize_nan_and_inf():
    json_data = get_test_json()
    json_data.insert(0, {'loss': float('nan'), 'epoch': float('inf'), 'iteration': 0})
    logs = [Log(data) for data in json_data]
    serialized_data = [log.serialize for log in logs]
    assert (serialized_data[0]['logDict']['iteration'] == 0)
    assert (serialized_data[0]['logDict']['epoch'] is None)
    assert (serialized_data[0]['logDict']['loss'] is None)
    assert (serialized_data[1]['logDict']['epoch'] == 1)
    assert (serialized_data[2]['logDict']['epoch'] == 2)
def test_log_serialize_nan_and_inf():
    json_data = get_test_json()
    json_data.insert(0, {'loss': float('nan'), 'epoch': float('inf'), 'iteration': 0})
    logs = [Log(data) for data in json_data]
    serialized_data = [log.serialize for log in logs]
    assert (serialized_data[0]['logDict']['iteration'] == 0)
    assert (serialized_data[0]['logDict']['epoch'] is None)
    assert (serialized_data[0]['logDict']['loss'] is None)
    assert (serialized_data[1]['logDict']['epoch'] == 1)
    assert (serialized_data[2]['logDict']['epoch'] == 2)