Passed
Push — main ( 13c337...ec726f )
by Yohann
01:49 queued 12s
created

TestSnowflake.test_conversions()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
import pytest
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
introduced by
Unable to import 'pytest'
Loading history...
2
3
from pincer.utils import Snowflake
4
5
6
class TestSnowflake:
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
7
8
    def test_boundaries(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
9
        with pytest.raises(ValueError):
10
            Snowflake(9223372036854775808)
11
            Snowflake(0)
12
13
    def test_conversions(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
14
        assert Snowflake(1) == 1
15
        assert Snowflake("1") == 1
16
17
    def test_timestamp(self):
0 ignored issues
show
Coding Style introduced by
This method could be written as a function/class method.

If a method does not access any attributes of the class, it could also be implemented as a function or static method. This can help improve readability. For example

class Foo:
    def some_method(self, x, y):
        return x + y;

could be written as

class Foo:
    @classmethod
    def some_method(cls, x, y):
        return x + y;
Loading history...
introduced by
Missing function or method docstring
Loading history...
18
        # values from: https://discord.com/developers/docs/reference#snowflakes.
19
        x = Snowflake(175928847299117063)
20
        assert x.timestamp == 41944705796
21
        assert x.unix == 1462015105796
22