-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72b5840
commit 7f0a073
Showing
7 changed files
with
82 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
from io import BytesIO | ||
from unittest import TestCase | ||
from os.path import join, dirname | ||
|
||
from aioaria2 import ControlFile, DHTFile | ||
|
||
|
||
class Testarser(TestCase): | ||
def test_ControlFile(self): | ||
s = BytesIO() | ||
data = ControlFile.from_file("180P_225K_242958531.webm.aria2") | ||
data = ControlFile.from_file2("180P_225K_242958531.webm.aria2") | ||
data.save(s) | ||
self.assertEqual( | ||
s.getvalue(), open("180P_225K_242958531.webm.aria2", "rb").read() | ||
) | ||
|
||
def test_DHTFile(self): | ||
s = BytesIO() | ||
data = DHTFile.from_file("dht.dat") | ||
data = DHTFile.from_file2(join(dirname(__file__), "dht.dat")) | ||
data.save(s) | ||
self.assertEqual(len(s.getvalue()), len(open("dht.dat", "rb").read())) | ||
self.assertEqual( | ||
len(s.getvalue()), | ||
len(open(join(dirname(__file__), "dht.dat"), "rb").read()), | ||
) | ||
|
||
def test_DHTFilev6(self): | ||
s = BytesIO() | ||
data = DHTFile.from_file("dht6.dat") | ||
data = DHTFile.from_file2(join(dirname(__file__), "dht6.dat")) | ||
data.save(s) | ||
self.assertEqual(len(s.getvalue()), len(open("dht6.dat", "rb").read())) | ||
self.assertEqual( | ||
len(s.getvalue()), | ||
len(open(join(dirname(__file__), "dht6.dat"), "rb").read()), | ||
) |