Skip to content

Commit f066a12

Browse files
committed
Corrected help formatting errors and improved some of the examples.
Signed-off-by: Kosta Ilic <kosta.ilic@emerson.com>
1 parent 60c98ed commit f066a12

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/nitypes/scalar.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ class Scalar(Generic[TScalar_co]):
5151
5252
You can compare scalar objects using the standard comparison operators as long as their units
5353
are the same and their value types are compatible:
54-
>>> s1 = Scalar(5.0, 'volts')
55-
>>> s2 = Scalar(10.0, 'volts')
54+
55+
>>> s1 = Scalar(5.0, 'V')
56+
>>> s2 = Scalar(10.0, 'V')
5657
>>> s1 < s2
5758
True
5859
>>> s1 <= s2
@@ -63,7 +64,7 @@ class Scalar(Generic[TScalar_co]):
6364
False
6465
>>> s1 == s2
6566
False
66-
>>> s3 = Scalar(5.0, 'volts')
67+
>>> s3 = Scalar(5.0, 'V')
6768
>>> s1 == s3
6869
True
6970
>>> s4 = Scalar("apple", "quantity")
@@ -83,14 +84,16 @@ class Scalar(Generic[TScalar_co]):
8384
True
8485
8586
Attempting to compare Scalar objects with different units raises a ValueError:
86-
>>> s1 = Scalar(5.0, 'volts')
87-
>>> s2 = Scalar(10.0, 'amps')
87+
88+
>>> s1 = Scalar(0.5, 'V')
89+
>>> s2 = Scalar(500, 'mV')
8890
>>> s1 < s2
8991
Traceback (most recent call last):
9092
...
9193
ValueError: Comparing Scalar objects with different units is not permitted.
9294
9395
Attempting to compare Scalar objects of numeric and string types raises a TypeError:
96+
9497
>>> s1 = Scalar(5.0, 'meters')
9598
>>> s2 = Scalar("value", 'meters')
9699
>>> s1 < s2

0 commit comments

Comments
 (0)