nepali 1.0.1__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nepali might be problematic. Click here for more details.
- nepali/{datetime/constants.py → constants.py} +15 -2
- nepali/date_converter.py +4 -4
- nepali/datetime/__init__.py +1 -1
- nepali/datetime/_datetime.py +12 -13
- nepali/datetime/_formatter.py +3 -2
- nepali/datetime/_humanize.py +14 -29
- nepali/datetime/_nepalimonth.py +7 -6
- nepali/datetime/_nepaliweek.py +4 -3
- nepali/datetime/parser/__init__.py +1 -1
- nepali/datetime/parser/_parser.py +7 -9
- nepali/datetime/parser/validators.py +162 -78
- nepali/datetime/utils.py +1 -0
- nepali/locations/__init__.py +1 -1
- nepali/locations/_locations.py +1 -1
- nepali/locations/utils.py +1 -2
- nepali/number/__init__.py +1 -1
- nepali/number/_nepalinumber.py +26 -12
- nepali/number/_number.py +1 -6
- nepali/number/utils.py +1 -2
- nepali/phone_number.py +2 -3
- nepali/templatetags/nepalidatetime.py +37 -0
- nepali/templatetags/nepalinumber.py +26 -0
- nepali/tests/test_date_converter.py +17 -4
- nepali/tests/test_datetime.py +3 -5
- nepali/tests/test_humanize.py +1 -2
- nepali/tests/test_locations.py +3 -3
- nepali/tests/test_number.py +35 -33
- nepali/tests/test_phone_number.py +3 -3
- nepali/tests/test_timezone.py +6 -5
- nepali/timezone.py +5 -3
- nepali/utils.py +1 -1
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/METADATA +11 -85
- nepali-1.1.1.dist-info/RECORD +46 -0
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/WHEEL +1 -1
- nepali-1.0.1.dist-info/RECORD +0 -46
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/LICENSE +0 -0
- {nepali-1.0.1.dist-info → nepali-1.1.1.dist-info}/top_level.txt +0 -0
nepali/datetime/utils.py
CHANGED
nepali/locations/__init__.py
CHANGED
nepali/locations/_locations.py
CHANGED
nepali/locations/utils.py
CHANGED
nepali/number/__init__.py
CHANGED
nepali/number/_nepalinumber.py
CHANGED
|
@@ -3,6 +3,7 @@ Contains the class for the nepalinumber feature
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from typing import Any, Tuple, Type, Union
|
|
6
|
+
|
|
6
7
|
from .utils import NP_NUMBERS, NP_NUMBERS_SET, english_to_nepali
|
|
7
8
|
|
|
8
9
|
|
|
@@ -19,10 +20,23 @@ class nepalinumber:
|
|
|
19
20
|
"""
|
|
20
21
|
self.__value = self.__parse(value)
|
|
21
22
|
|
|
22
|
-
def
|
|
23
|
-
|
|
23
|
+
def get_parse_exception(
|
|
24
|
+
self, obj: object, ex_class: Type[Exception] = ValueError
|
|
25
|
+
) -> Exception:
|
|
26
|
+
"""
|
|
27
|
+
Returns the exception object to be raised when the parse is failed.
|
|
28
|
+
The methods also sets a proper message to the exception class.
|
|
29
|
+
|
|
30
|
+
:param obj: Object that is failed during the parse
|
|
31
|
+
:type obj: object
|
|
32
|
+
:param ex_class: Exception class type to be returned, defaults to ValueError
|
|
33
|
+
:type ex_class: Type[Exception], optional
|
|
34
|
+
:return: Exception object to be raised
|
|
35
|
+
:rtype: Exception
|
|
36
|
+
"""
|
|
37
|
+
return ex_class(
|
|
24
38
|
f"could not convert {obj.__class__.__name__} to {self.__class__.__name__}: '{obj}'"
|
|
25
|
-
)
|
|
39
|
+
)
|
|
26
40
|
|
|
27
41
|
def __parse(self, value: Any) -> Union[int, float]:
|
|
28
42
|
"""
|
|
@@ -61,10 +75,10 @@ class nepalinumber:
|
|
|
61
75
|
|
|
62
76
|
:raises ValueError: If the value is invalid
|
|
63
77
|
"""
|
|
64
|
-
result = 0
|
|
78
|
+
result: float = 0
|
|
65
79
|
sign = 1
|
|
66
80
|
decimal_found = False
|
|
67
|
-
decimal_place = 1
|
|
81
|
+
decimal_place: float = 1
|
|
68
82
|
i = 0
|
|
69
83
|
|
|
70
84
|
# for negative sign
|
|
@@ -77,7 +91,7 @@ class nepalinumber:
|
|
|
77
91
|
if value[i] == ".":
|
|
78
92
|
if decimal_found:
|
|
79
93
|
# decimal was already found
|
|
80
|
-
self.
|
|
94
|
+
raise self.get_parse_exception(value) from None
|
|
81
95
|
decimal_found = True
|
|
82
96
|
i += 1
|
|
83
97
|
continue
|
|
@@ -86,7 +100,7 @@ class nepalinumber:
|
|
|
86
100
|
if digit < 0 or digit > 9:
|
|
87
101
|
# checking nepali character
|
|
88
102
|
if value[i] not in NP_NUMBERS_SET:
|
|
89
|
-
self.
|
|
103
|
+
raise self.get_parse_exception(value) from None
|
|
90
104
|
digit = NP_NUMBERS.index(value[i])
|
|
91
105
|
|
|
92
106
|
if decimal_found:
|
|
@@ -113,7 +127,7 @@ class nepalinumber:
|
|
|
113
127
|
return self.__parse_str(str(obj))
|
|
114
128
|
except (ValueError, TypeError):
|
|
115
129
|
# object conversion must raise TypeError if fails
|
|
116
|
-
self.
|
|
130
|
+
raise self.get_parse_exception(obj, ex_class=TypeError) from None
|
|
117
131
|
|
|
118
132
|
def __convert_or_return(self, obj) -> Union["nepalinumber", object]:
|
|
119
133
|
"""
|
|
@@ -184,7 +198,7 @@ class nepalinumber:
|
|
|
184
198
|
Checks if nepalinumber is equal to another object
|
|
185
199
|
|
|
186
200
|
:param other: The other number/object which is to be checked for
|
|
187
|
-
equality
|
|
201
|
+
equality against nepalinumber
|
|
188
202
|
:return: True if equal else False
|
|
189
203
|
"""
|
|
190
204
|
if isinstance(other, nepalinumber):
|
|
@@ -197,7 +211,7 @@ class nepalinumber:
|
|
|
197
211
|
Checks if nepalinumber is not equal to another object
|
|
198
212
|
|
|
199
213
|
:param other: The other number/object which is to be checked for
|
|
200
|
-
equality
|
|
214
|
+
equality against nepalinumber
|
|
201
215
|
:return: True if not equal else False
|
|
202
216
|
"""
|
|
203
217
|
if isinstance(other, nepalinumber):
|
|
@@ -349,7 +363,7 @@ class nepalinumber:
|
|
|
349
363
|
the nepalinumber object
|
|
350
364
|
|
|
351
365
|
:param other: The other number/object that is to get
|
|
352
|
-
|
|
366
|
+
divided by the value in the nepalinumber object
|
|
353
367
|
:raises TypeError: Raised when nepalinumber object is
|
|
354
368
|
used to divide unsupported data types
|
|
355
369
|
:return: Returns the quotient number as a nepalinumber
|
|
@@ -388,7 +402,7 @@ class nepalinumber:
|
|
|
388
402
|
before the nepalinumber object
|
|
389
403
|
|
|
390
404
|
:param other: The other number/object that is to get
|
|
391
|
-
|
|
405
|
+
divided by the value in the nepalinumber object
|
|
392
406
|
:raises TypeError: Raised when nepalinumber object is
|
|
393
407
|
used to divide unsupported data types
|
|
394
408
|
:return: Returns the quotient number as a nepalinumber
|
nepali/number/_number.py
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import warnings
|
|
2
2
|
|
|
3
|
-
from .utils import
|
|
4
|
-
add_comma,
|
|
5
|
-
add_comma_english,
|
|
6
|
-
english_to_nepali,
|
|
7
|
-
nepali_to_english,
|
|
8
|
-
)
|
|
3
|
+
from .utils import add_comma, add_comma_english, english_to_nepali, nepali_to_english
|
|
9
4
|
|
|
10
5
|
|
|
11
6
|
# Backward compatibility support for legacy NepaliNumber
|
nepali/number/utils.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from typing import Any
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
NP_NUMBERS = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"]
|
|
5
4
|
NP_NUMBERS_SET = set(NP_NUMBERS)
|
|
6
5
|
|
|
@@ -39,7 +38,7 @@ def add_comma_english(number: Any) -> str:
|
|
|
39
38
|
Adds comma in english style
|
|
40
39
|
Eg. 123456789 => 123,456,789
|
|
41
40
|
"""
|
|
42
|
-
return "{
|
|
41
|
+
return f"{int(number):,}"
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
def add_comma(number: Any, convert=False) -> str:
|
nepali/phone_number.py
CHANGED
|
@@ -2,10 +2,9 @@ import re
|
|
|
2
2
|
from enum import Enum
|
|
3
3
|
from typing import Union
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
_mobile_number_re = re.compile(r"^(?:\+977|977)?(?:-)?(?:98|97|96)[0-9]{8}$")
|
|
5
|
+
_mobile_number_re = re.compile(r"^(?:\+977|977)?(?:-)?(?:98|97|96)\d{8}$")
|
|
7
6
|
_landline_number_re = re.compile(
|
|
8
|
-
r"^(?:\+977|977)?(?:-)?(?:0)?(?:[01][1-9]|2[13-9]|[3-9]
|
|
7
|
+
r"^(?:\+977|977)?(?:-)?(?:0)?(?:[01][1-9]|2[13-9]|[3-9]\d)\d{6,7}$"
|
|
9
8
|
)
|
|
10
9
|
|
|
11
10
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains django templatetags for nepali date and time.
|
|
3
|
+
"""
|
|
1
4
|
import datetime
|
|
5
|
+
import warnings
|
|
2
6
|
from typing import Optional, Union
|
|
3
7
|
|
|
4
8
|
from django import template
|
|
@@ -11,6 +15,11 @@ from nepali.exceptions import InvalidNepaliDateTimeObjectException
|
|
|
11
15
|
from nepali.utils import to_nepalidatetime
|
|
12
16
|
|
|
13
17
|
_DEFAULT_DATE_FORMAT = "%B %d, %Y, %A"
|
|
18
|
+
DEPRECIATION_WARNING_MESSAGE = (
|
|
19
|
+
"The templatetag 'nepalidatetime' has been depreciated "
|
|
20
|
+
"and will be removed in the future release. "
|
|
21
|
+
"Please use `django-nepali` package."
|
|
22
|
+
)
|
|
14
23
|
_datetime = Union[datetime.date, datetime.datetime, _nepalidate, _nepalidatetime]
|
|
15
24
|
register = template.Library()
|
|
16
25
|
|
|
@@ -32,6 +41,10 @@ def nepalidate(
|
|
|
32
41
|
:param format: Output format, defaults to "%B %d, %Y, %A"
|
|
33
42
|
:returns: Nepali datetime format in 'en-US' locale
|
|
34
43
|
"""
|
|
44
|
+
warnings.warn(
|
|
45
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
46
|
+
category=DeprecationWarning,
|
|
47
|
+
)
|
|
35
48
|
return nepalidate_en(datetime_obj, format=format)
|
|
36
49
|
|
|
37
50
|
|
|
@@ -52,6 +65,10 @@ def nepalidate_en(
|
|
|
52
65
|
:param format: Output format, defaults to "%B %d, %Y, %A"
|
|
53
66
|
:returns: Nepali datetime format in 'en-US' locale
|
|
54
67
|
"""
|
|
68
|
+
warnings.warn(
|
|
69
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
70
|
+
category=DeprecationWarning,
|
|
71
|
+
)
|
|
55
72
|
try:
|
|
56
73
|
nepali_datetime_obj = to_nepalidatetime(datetime_obj)
|
|
57
74
|
return nepali_datetime_obj.strftime_en(format)
|
|
@@ -76,6 +93,10 @@ def nepalidate_ne(
|
|
|
76
93
|
:param format: Output format, defaults to "%B %d, %Y, %A"
|
|
77
94
|
:returns: Nepali datetime format in 'ne' locale
|
|
78
95
|
"""
|
|
96
|
+
warnings.warn(
|
|
97
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
98
|
+
category=DeprecationWarning,
|
|
99
|
+
)
|
|
79
100
|
try:
|
|
80
101
|
nepali_datetime_obj = to_nepalidatetime(datetime_obj)
|
|
81
102
|
return nepali_datetime_obj.strftime_ne(format)
|
|
@@ -103,6 +124,10 @@ def nepalihumanize(
|
|
|
103
124
|
:param format: Output format if threshold exceeded, optional
|
|
104
125
|
:returns: Datetime object in human readable form
|
|
105
126
|
"""
|
|
127
|
+
warnings.warn(
|
|
128
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
129
|
+
category=DeprecationWarning,
|
|
130
|
+
)
|
|
106
131
|
try:
|
|
107
132
|
nepali_datetime_obj = to_nepalidatetime(datetime_obj)
|
|
108
133
|
return humanize(nepali_datetime_obj, threshold=threshold, format=format)
|
|
@@ -125,6 +150,10 @@ def nepalinow(format: str = _DEFAULT_DATE_FORMAT) -> str:
|
|
|
125
150
|
:param format: Output format, defaults to "%B %d, %Y, %A"
|
|
126
151
|
:returns: Current nepali datetime
|
|
127
152
|
"""
|
|
153
|
+
warnings.warn(
|
|
154
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
155
|
+
category=DeprecationWarning,
|
|
156
|
+
)
|
|
128
157
|
return nepalinow_en(format)
|
|
129
158
|
|
|
130
159
|
|
|
@@ -143,6 +172,10 @@ def nepalinow_en(format: str = _DEFAULT_DATE_FORMAT) -> str:
|
|
|
143
172
|
:param format: Output format, defaults to "%B %d, %Y, %A"
|
|
144
173
|
:returns: Current nepali datetime
|
|
145
174
|
"""
|
|
175
|
+
warnings.warn(
|
|
176
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
177
|
+
category=DeprecationWarning,
|
|
178
|
+
)
|
|
146
179
|
return to_nepalidatetime(timezone.now()).strftime(format)
|
|
147
180
|
|
|
148
181
|
|
|
@@ -161,4 +194,8 @@ def nepalinow_ne(format: str = _DEFAULT_DATE_FORMAT) -> str:
|
|
|
161
194
|
:param format: Output format, defaults to "%B %d, %Y, %A"
|
|
162
195
|
:returns: Current nepali datetime
|
|
163
196
|
"""
|
|
197
|
+
warnings.warn(
|
|
198
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
199
|
+
category=DeprecationWarning,
|
|
200
|
+
)
|
|
164
201
|
return to_nepalidatetime(timezone.now()).strftime_ne(format)
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains django templatetags for nepali number.
|
|
3
|
+
"""
|
|
4
|
+
import warnings
|
|
1
5
|
from typing import Any
|
|
2
6
|
|
|
3
7
|
from django import template
|
|
@@ -11,6 +15,12 @@ from nepali.number import (
|
|
|
11
15
|
|
|
12
16
|
register = template.Library()
|
|
13
17
|
|
|
18
|
+
DEPRECIATION_WARNING_MESSAGE = (
|
|
19
|
+
"The templatetag 'nepalinumber' has been depreciated "
|
|
20
|
+
"and will be removed in the future release. "
|
|
21
|
+
"Please use `django-nepali` package."
|
|
22
|
+
)
|
|
23
|
+
|
|
14
24
|
|
|
15
25
|
@register.filter(name="nepalinumber")
|
|
16
26
|
def nepalinumber(value: Any) -> str:
|
|
@@ -25,6 +35,10 @@ def nepalinumber(value: Any) -> str:
|
|
|
25
35
|
:param value: Number to be converted
|
|
26
36
|
:returns: Nepali output of given number
|
|
27
37
|
"""
|
|
38
|
+
warnings.warn(
|
|
39
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
40
|
+
category=DeprecationWarning,
|
|
41
|
+
)
|
|
28
42
|
return english_to_nepali(value)
|
|
29
43
|
|
|
30
44
|
|
|
@@ -42,6 +56,10 @@ def nepalinumber_with_comma(value: Any) -> str:
|
|
|
42
56
|
:param value: Number to be converted and commas added
|
|
43
57
|
:returns: Nepali output of given number with commas
|
|
44
58
|
"""
|
|
59
|
+
warnings.warn(
|
|
60
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
61
|
+
category=DeprecationWarning,
|
|
62
|
+
)
|
|
45
63
|
return convert_and_add_comma(value)
|
|
46
64
|
|
|
47
65
|
|
|
@@ -58,6 +76,10 @@ def nepali_comma(value: Any) -> str:
|
|
|
58
76
|
:param value: Number to be added with commas
|
|
59
77
|
:returns: Output of given number with commas
|
|
60
78
|
"""
|
|
79
|
+
warnings.warn(
|
|
80
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
81
|
+
category=DeprecationWarning,
|
|
82
|
+
)
|
|
61
83
|
return add_comma(value)
|
|
62
84
|
|
|
63
85
|
|
|
@@ -74,4 +96,8 @@ def english_comma(value: Any) -> str:
|
|
|
74
96
|
:param value: Number to be added with commas
|
|
75
97
|
:returns: Output of given number with commas
|
|
76
98
|
"""
|
|
99
|
+
warnings.warn(
|
|
100
|
+
message=DEPRECIATION_WARNING_MESSAGE,
|
|
101
|
+
category=DeprecationWarning,
|
|
102
|
+
)
|
|
77
103
|
return add_comma_english(value)
|
|
@@ -9,6 +9,7 @@ from nepali.date_converter import converter
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class TestNepaliDateConverter(unittest.TestCase):
|
|
12
|
+
"""tests for date_converter.converter module"""
|
|
12
13
|
# test date range
|
|
13
14
|
def test_english_date_range(self):
|
|
14
15
|
self.assertEqual(converter.en_min_year(), 1944)
|
|
@@ -49,6 +50,12 @@ class TestNepaliDateConverter(unittest.TestCase):
|
|
|
49
50
|
self.assertEqual(m, 4)
|
|
50
51
|
self.assertEqual(d, 29)
|
|
51
52
|
|
|
53
|
+
def test_converter_english_to_nepali_returns_valid_past_nepali_date2(self):
|
|
54
|
+
y, m, d = converter.english_to_nepali(1944, 5, 28)
|
|
55
|
+
self.assertEqual(y, 2001)
|
|
56
|
+
self.assertEqual(m, 2)
|
|
57
|
+
self.assertEqual(d, 15)
|
|
58
|
+
|
|
52
59
|
def test_converter_english_to_nepali_returns_valid_recent_nepali_date(self):
|
|
53
60
|
y, m, d = converter.english_to_nepali(2023, 1, 28)
|
|
54
61
|
self.assertEqual(y, 2079)
|
|
@@ -98,25 +105,31 @@ class TestNepaliDateConverter(unittest.TestCase):
|
|
|
98
105
|
with self.assertRaises(Exception):
|
|
99
106
|
converter.nepali_to_english(2079, 1, 40)
|
|
100
107
|
|
|
101
|
-
def
|
|
108
|
+
def test_converter_nepali_to_english_returns_valid_past_english_date(self):
|
|
102
109
|
y, m, d = converter.nepali_to_english(2051, 4, 29)
|
|
103
110
|
self.assertEqual(y, 1994)
|
|
104
111
|
self.assertEqual(m, 8)
|
|
105
112
|
self.assertEqual(d, 13)
|
|
106
113
|
|
|
107
|
-
def
|
|
114
|
+
def test_converter_nepali_to_english_returns_valid_past_english_date2(self):
|
|
115
|
+
y, m, d = converter.nepali_to_english(2001, 2, 15)
|
|
116
|
+
self.assertEqual(y, 1944)
|
|
117
|
+
self.assertEqual(m, 5)
|
|
118
|
+
self.assertEqual(d, 28)
|
|
119
|
+
|
|
120
|
+
def test_converter_nepali_to_english_returns_valid_recent_english_date(self):
|
|
108
121
|
y, m, d = converter.nepali_to_english(2079, 10, 14)
|
|
109
122
|
self.assertEqual(y, 2023)
|
|
110
123
|
self.assertEqual(m, 1)
|
|
111
124
|
self.assertEqual(d, 28)
|
|
112
125
|
|
|
113
|
-
def
|
|
126
|
+
def test_converter_nepali_to_english_returns_valid_future_english_date(self):
|
|
114
127
|
y, m, d = converter.nepali_to_english(2087, 8, 10)
|
|
115
128
|
self.assertEqual(y, 2030)
|
|
116
129
|
self.assertEqual(m, 11)
|
|
117
130
|
self.assertEqual(d, 26)
|
|
118
131
|
|
|
119
|
-
def
|
|
132
|
+
def test_converter_nepali_to_english_returns_valid_english_leap_year_date(self):
|
|
120
133
|
y, m, d = converter.nepali_to_english(2080, 12, 15)
|
|
121
134
|
self.assertEqual(y, 2024)
|
|
122
135
|
self.assertEqual(m, 3)
|
nepali/tests/test_datetime.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import unittest
|
|
3
3
|
|
|
4
|
-
from nepali.datetime import nepalidate,
|
|
5
|
-
from nepali.datetime.utils import
|
|
4
|
+
from nepali.datetime import nepalidate, nepalidatetime, nepalitime
|
|
5
|
+
from nepali.datetime.utils import to_nepalidate, to_nepalidatetime
|
|
6
6
|
from nepali.exceptions import InvalidNepaliDateTimeObjectException
|
|
7
7
|
from nepali.timezone import NepaliTimeZone
|
|
8
8
|
|
|
@@ -250,9 +250,7 @@ class TestNepaliDateTime(unittest.TestCase):
|
|
|
250
250
|
self.assertEqual(
|
|
251
251
|
nepalidatetime_obj1,
|
|
252
252
|
nepalidatetime_obj2,
|
|
253
|
-
msg="{} and {} are not equal"
|
|
254
|
-
nepalidatetime_obj1, nepalidatetime_obj2
|
|
255
|
-
),
|
|
253
|
+
msg=f"{nepalidatetime_obj1} and {nepalidatetime_obj2} are not equal",
|
|
256
254
|
)
|
|
257
255
|
|
|
258
256
|
|
nepali/tests/test_humanize.py
CHANGED
|
@@ -2,11 +2,10 @@ import datetime
|
|
|
2
2
|
import unittest
|
|
3
3
|
from unittest.mock import patch
|
|
4
4
|
|
|
5
|
-
from nepali.datetime import
|
|
5
|
+
from nepali.datetime import HumanizeDateTime, nepalidate, nepalidatetime, nepalihumanize
|
|
6
6
|
from nepali.exceptions import InvalidNepaliDateTimeObjectException
|
|
7
7
|
from nepali.timezone import NepaliTimeZone
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
REF_TIME = datetime.datetime(2015, 1, 1, 10, 15, tzinfo=NepaliTimeZone())
|
|
11
10
|
|
|
12
11
|
|
nepali/tests/test_locations.py
CHANGED
|
@@ -2,17 +2,17 @@ import unittest
|
|
|
2
2
|
|
|
3
3
|
from nepali import locations
|
|
4
4
|
from nepali.locations.models import (
|
|
5
|
+
District,
|
|
5
6
|
Location,
|
|
7
|
+
Municipality,
|
|
6
8
|
MunicipalityType,
|
|
7
9
|
Province,
|
|
8
|
-
District,
|
|
9
|
-
Municipality,
|
|
10
10
|
)
|
|
11
11
|
from nepali.locations.utils import (
|
|
12
12
|
_filter_location,
|
|
13
|
-
get_province,
|
|
14
13
|
get_district,
|
|
15
14
|
get_municipality,
|
|
15
|
+
get_province,
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
|