Skip to content

Commit

Permalink
Exclude System.Net.Sse from code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriktsarpalis committed Dec 9, 2024
1 parent 03da47c commit 17db884
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ public static ChatOptions FromOpenAIOptions(OpenAI.Chat.ChatCompletionOptions? o
(result.AdditionalProperties ??= [])[nameof(options.TopLogProbabilityCount)] = topLogProbabilityCount;
}

if (options.Metadata is IDictionary<string, string> { Count: > 0 } metadata)
{
(result.AdditionalProperties ??= [])[nameof(options.Metadata)] = metadata;
}

if (options.StoredOutputEnabled is bool storedOutputEnabled)
{
(result.AdditionalProperties ??= [])[nameof(options.StoredOutputEnabled)] = storedOutputEnabled;
}

if (options.Tools is { Count: > 0 } tools)
{
foreach (ChatTool tool in tools)
Expand Down Expand Up @@ -273,6 +283,19 @@ public static OpenAI.Chat.ChatCompletionOptions ToOpenAIOptions(ChatOptions? opt
{
result.TopLogProbabilityCount = topLogProbabilityCountInt;
}

if (additionalProperties.TryGetValue(nameof(result.Metadata), out IDictionary<string, string>? metadata))
{
foreach (KeyValuePair<string, string> kvp in metadata)
{
result.Metadata[kvp.Key] = kvp.Value;
}
}

if (additionalProperties.TryGetValue(nameof(result.StoredOutputEnabled), out bool storeOutputEnabled))
{
result.StoredOutputEnabled = storeOutputEnabled;
}
}

if (options.Tools is { Count: > 0 } tools)
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/ArrayBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace System.Net
// Discard(byteCount) will discard [byteCount] bytes as the beginning of the ActiveSpan.

[StructLayout(LayoutKind.Auto)]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal struct ArrayBuffer : IDisposable
{
private readonly bool _usePool;
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
namespace System.Net.ServerSentEvents
{
[EditorBrowsable(EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class Helpers
{
public static void WriteUtf8Number(this IBufferWriter<byte> writer, long value)
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/PooledByteBufferWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace System.Net.ServerSentEvents
{
[EditorBrowsable(EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class PooledByteBufferWriter : IBufferWriter<byte>, IDisposable
{
private const int MinimumBufferSize = 256;
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/SseFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace System.Net.ServerSentEvents
/// <summary>
/// Provides methods for formatting server-sent events.
/// </summary>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class SseFormatter
{
private static readonly byte[] _newLine = "\n"u8.ToArray();
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/SseItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace System.Net.ServerSentEvents
{
/// <summary>Represents a server-sent event.</summary>
/// <typeparam name="T">Specifies the type of data payload in the event.</typeparam>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal readonly struct SseItem<T>
{
/// <summary>The event's type.</summary>
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/SseParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace System.Net.ServerSentEvents
{
/// <summary>Provides a parser for parsing server-sent events.</summary>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class SseParser
{
/// <summary>The default <see cref="SseItem{T}.EventType"/> ("message") for an event that did not explicitly specify a type.</summary>
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/SseParser_1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace System.Net.ServerSentEvents
{
/// <summary>Provides a parser for server-sent events information.</summary>
/// <typeparam name="T">Specifies the type of data parsed from an event.</typeparam>
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal sealed class SseParser<T>
{
// For reference:
Expand Down
1 change: 1 addition & 0 deletions src/Shared/ServerSentEvents/ThrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace System.Net.ServerSentEvents
{
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal static class ThrowHelper
{
[DoesNotReturn]
Expand Down

0 comments on commit 17db884

Please sign in to comment.