File tree Expand file tree Collapse file tree 2 files changed +12
-16
lines changed Expand file tree Collapse file tree 2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -45,26 +45,22 @@ impl PyUuid {
45
45
}
46
46
47
47
#[ getter]
48
- pub fn urn ( & self ) -> & str {
49
- let mut buffer = Uuid :: encode_buffer ( ) ;
50
- self . lib_uuid . urn ( ) . encode_lower ( & mut buffer) ;
51
- "foo"
48
+ pub fn urn ( & self ) -> String {
49
+ format ! ( "{}" , self . lib_uuid. urn( ) )
52
50
}
53
51
54
52
#[ getter]
55
- pub fn variant ( & self ) -> & str {
56
- // self.lib_uuid.get_variant().to_string().as_str()
57
- "bar"
53
+ pub fn variant ( & self ) -> String {
54
+ format ! ( "{}" , self . lib_uuid. get_variant( ) )
58
55
}
59
56
60
57
#[ getter]
61
58
pub fn version ( & self ) -> usize {
62
59
self . lib_uuid . get_version_num ( )
63
60
}
64
61
65
- pub fn __str__ ( & self ) -> & str {
66
- // self.lib_uuid.hyphenated().to_string().as_str()
67
- "baz"
62
+ pub fn __str__ ( & self ) -> String {
63
+ format ! ( "{}" , self . lib_uuid. hyphenated( ) )
68
64
}
69
65
70
66
pub fn __repr__ ( & self ) -> String {
Original file line number Diff line number Diff line change @@ -10,9 +10,9 @@ def test_uuid_ok(py_and_json: PyAndJson):
10
10
assert isinstance (uuid , Uuid )
11
11
assert str (uuid ) == '12345678-1234-5678-1234-567812345678'
12
12
assert repr (uuid ) == "Uuid('12345678-1234-5678-1234-567812345678')"
13
- assert uuid .version == 4
14
- assert uuid .urn == 'foo'
15
- assert uuid .variant == 'bar '
13
+ assert uuid .urn == 'urn:uuid:12345678-1234-5678-1234-567812345678'
14
+ assert uuid .version == 5
15
+ assert uuid .variant == 'NCS '
16
16
17
17
18
18
def test_uuid_from_constructor_ok ():
@@ -21,6 +21,6 @@ def test_uuid_from_constructor_ok():
21
21
assert isinstance (uuid , Uuid )
22
22
assert str (uuid ) == '12345678-1234-5678-1234-567812345678'
23
23
assert repr (uuid ) == "Uuid('12345678-1234-5678-1234-567812345678')"
24
- assert uuid .version == 4
25
- assert uuid .urn == 'foo'
26
- assert uuid .variant == 'bar '
24
+ assert uuid .urn == 'urn:uuid:12345678-1234-5678-1234-567812345678'
25
+ assert uuid .version == 5
26
+ assert uuid .variant == 'NCS '
You can’t perform that action at this time.
0 commit comments